/* Bidragskompassen – base: reset, typography, layout primitives, buttons, chips, header, footer */

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  interpolate-size: allow-keywords;
}
body {
  margin: 0;
  background: var(--beige-100);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: var(--lh);
  font-weight: 400;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
strong, b { font-weight: 700; }
mark { background: var(--mark-bg); color: inherit; font-weight: 700; padding: 0 1px; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
main:focus { outline: none; }

/* ---------- Typography ---------- */
.serif, h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: var(--track-serif); line-height: 1.15; }
h3 { font-family: var(--serif); font-weight: 700; font-size: var(--fs-h3); line-height: 1.2; }
em, .italic { font-style: italic; }
.label-caps {
  font-family: var(--sans); font-size: 11px; font-weight: 700; line-height: 1.2;
  letter-spacing: var(--track-caps); text-transform: uppercase;
}
.ingress { font-size: var(--fs-ingress); font-weight: 700; line-height: 1.3; }
.small { font-size: var(--fs-sm); }
.soft { color: var(--text-soft); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.section { position: relative; padding-block: var(--sp-2xl); background: var(--surface); }
.section.on-dark { background: var(--blue-600); }
.section--tint { --surface: var(--beige-200); background: var(--beige-200); }

.section-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}
.section-head__meta {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between; gap: var(--sp-md);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--hairline-strong);
  color: var(--text-soft);
}
.section-head__title { grid-column: 1 / span 3; font-size: var(--fs-h2); }
.section-head__lead { grid-column: 3 / span 2; max-width: 44ch; }
@media (max-width: 800px) {
  .section-head__title, .section-head__lead { grid-column: 1 / -1; }
}

/* ---------- Buttons (pill, label caps) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-sm);
  min-height: 44px; padding: 14px 24px;
  border: 0; border-radius: var(--r-pill);
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: var(--track-caps); text-transform: uppercase; line-height: 1.2;
  text-decoration: none; white-space: nowrap;
  transition: background-color 0.2s, transform 0.2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--violet); color: var(--white); }
.btn--primary:hover { background: var(--violet-deep); }
.btn--secondary { background: var(--blue-400); color: var(--white); }
.btn--secondary:hover { background: var(--blue-500); }
.btn--light { background: var(--white); color: var(--blue-600); }
.btn--light:hover { background: var(--blue-100); }
.btn .arrow { display: inline-block; transition: transform 0.25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

.link-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px;
  padding: 2px 0; border: 0; background: none;
  font-weight: 700; text-decoration: underline; text-underline-offset: 0.2em;
}
.link-btn:hover { text-decoration-thickness: 2px; }

/* ---------- Chips / toggles (4px radius) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 6px 12px;
  border: 1px solid var(--hairline-strong); border-radius: var(--r-sm);
  background: transparent; color: var(--text);
  font-size: var(--fs-sm); line-height: 1.2; text-align: left;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.chip:hover { border-color: var(--text); }
.chip[aria-pressed="true"] { background: var(--blue-600); border-color: var(--blue-600); color: var(--white); }
.chip[aria-pressed="true"]::before { content: "✓"; font-weight: 700; }
.on-dark .chip[aria-pressed="true"] { background: var(--white); color: var(--blue-600); border-color: var(--white); }

/* Switch built on a real checkbox */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; min-height: 32px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 24px; margin: 0; cursor: pointer; }
.switch__track {
  flex: none; position: relative; width: 44px; height: 24px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline-strong); background: transparent; transition: background-color 0.2s;
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); transition: transform 0.25s var(--ease), background-color 0.2s;
}
.switch input:checked + .switch__track { background: var(--blue-600); border-color: var(--blue-600); }
.switch input:checked + .switch__track::after { transform: translateX(20px); background: var(--white); }
.on-dark .switch input:checked + .switch__track { background: var(--white); border-color: var(--white); }
.on-dark .switch input:checked + .switch__track::after { background: var(--blue-600); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--focus); outline-offset: 3px; }
.switch__state { font-weight: 700; min-width: 3ch; }

/* ---------- Status tags (blue scale + symbol + text, never colour alone) ---------- */
.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 11px; font-weight: 700; letter-spacing: var(--track-caps); text-transform: uppercase; white-space: nowrap;
}
.status__sym { font-size: 12px; letter-spacing: 0; }
.status--open { background: var(--blue-600); color: var(--white); }
.status--soon { background: var(--blue-200); color: var(--blue-600); }
.status--closed, .status--unknown { border-color: var(--hairline-strong); color: var(--text); }
.status--auto { background: var(--beige-300); color: var(--ink); }
.status--ended { border: 1px dashed var(--hairline-strong); color: var(--text); }
.on-dark .status--open { background: var(--white); color: var(--blue-600); }

.note {
  padding: var(--sp-md) var(--sp-md) var(--sp-md) 20px;
  border-left: 3px solid var(--blue-400);
  background: var(--blue-100);
  color: var(--ink);
}

/* ---------- Skip link, notices ---------- */
.skip-link {
  position: absolute; left: var(--sp-md); top: -100px; z-index: 100;
  padding: 12px 20px; background: var(--white); color: var(--blue-600); font-weight: 700;
}
.skip-link:focus { top: var(--sp-md); }
.sample-banner {
  background: var(--beige-300); color: var(--ink); text-align: center;
  padding: 8px var(--gutter); font-size: var(--fs-sm);
}

/* ---------- Motion ---------- */
.js [data-reveal] {
  opacity: 0; transform: translateY(28px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

.reduce-motion, .reduce-motion * , .reduce-motion *::before, .reduce-motion *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important; transition-delay: 0s !important;
  scroll-behavior: auto !important;
}
.reduce-motion [data-reveal] { opacity: 1; transform: none; }
