/*
 * Hitta skydd, hittaskydd.se: the one stylesheet for the whole site.
 *
 * Why this is a file and not an inline <style> block: the site is served with
 * Content-Security-Policy "default-src 'self'". Without an explicit style-src,
 * that policy blocks inline <style> elements and style="" attributes, so
 * inline CSS would silently not apply. A same-origin file is allowed by 'self'
 * and needs no hash or 'unsafe-inline' in the Caddyfile.
 *
 * Rules for this site: no external resources of any kind (no web fonts, no
 * CDNs, no analytics, no remote images), system fonts only, square corners,
 * hairline rules, one blue accent. Never use the orange/blue civil-defence
 * emblem or anything resembling it (protected under Lag (2014:812)).
 */

:root {
  --paper: #ffffff;
  --ink: #14161a;
  --muted: #50555c;
  --rule: #d6d9dd;
  --tint: #f4f5f7;
  --accent: #14487a;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14161a;
    --ink: #eceef1;
    --muted: #a9aeb5;
    --rule: #33373e;
    --tint: #1b1e23;
    /* Same hue as #14487a, lifted so links keep ~9:1 contrast on the dark paper. */
    --accent: #9cc0e6;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  overflow-wrap: break-word;
}

/* Scripts other than Latin: local system fonts only, never downloaded. */
:lang(ar),
:lang(fa) {
  font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, "Geeza Pro", var(--sans);
}

:lang(ti) {
  font-family: "Noto Sans Ethiopic", "Abyssinica SIL", Nyala, Ebrima, Kefa, var(--sans);
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 40em) {
  .wrap {
    padding: 0 1.5rem;
  }
}

/* ---------- links and focus ---------- */

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
}

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 2px solid var(--ink);
}

.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.25rem;
  padding-top: 0.9rem;
  padding-bottom: 0.75rem;
}

.brand {
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.masthead nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.masthead nav a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.masthead nav a:hover {
  border-bottom-color: var(--ink);
}

/* ---------- landing: intro ---------- */

.intro {
  padding: 2.5rem 0 2rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.9rem, 1.35rem + 2.6vw, 2.75rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.intro h1 {
  max-width: 17ch;
}

.lede {
  max-width: 36rem;
  margin: 0 0 1.5rem;
  font-size: 1.1875rem;
  line-height: 1.5;
}

.status {
  margin: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------- landing: sections ---------- */

.section {
  padding: 2rem 0 2.25rem;
  border-top: 1px solid var(--ink);
}

.section > h2 {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.num {
  display: inline-block;
  min-width: 2.1ch;
  margin-right: 0.5rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.section h3 {
  margin: 1.5rem 0 0.4rem;
  font-size: 1.0625rem;
  line-height: 1.35;
}

.section p {
  margin: 0 0 0.9rem;
}

.points {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.points > li {
  padding: 1rem 0 1.1rem;
  border-top: 1px solid var(--rule);
}

.points h3 {
  margin: 0 0 0.35rem;
}

.points p {
  margin: 0;
}

@media (min-width: 44em) {
  .points {
    grid-template-columns: 1fr 1fr;
    column-gap: 2rem;
  }
}

.langs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.langs li {
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--rule);
  font-size: 0.9375rem;
}

.plain {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.plain > li {
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
}

.plain > li:last-child {
  border-bottom: 1px solid var(--rule);
}

.callout {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--tint);
}

.callout p {
  margin: 0;
}

.callout p + p {
  margin-top: 0.4rem;
}

.note {
  color: var(--muted);
  font-size: 0.9375rem;
}

/* The statute quote. */
.law {
  margin: 1.25rem 0 1.25rem;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--accent);
}

.law blockquote {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.5;
}

.law blockquote p {
  margin: 0;
}

.law figcaption {
  color: var(--muted);
  font-size: 0.875rem;
}

.dash {
  margin: 0 0 1rem;
  padding: 0 0 0 1.25rem;
}

.dash li {
  margin: 0 0 0.55rem;
  padding-left: 0.25rem;
}

/* ---------- footer ---------- */

.site-foot {
  margin-top: 1rem;
  padding: 1.25rem 0 2.5rem;
  border-top: 2px solid var(--ink);
  color: var(--muted);
  font-size: 0.9375rem;
}

.site-foot p {
  margin: 0 0 0.5rem;
}

/* ---------- privacy policy (integritet) ---------- */

.doc {
  padding: 2.25rem 0 1rem;
}

.doc h1 {
  margin-bottom: 0.5rem;
}

.meta {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.toc {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--rule);
}

/* .doc .toc beats the later ".doc h2" rule, which would otherwise add a rule and padding here. */
.doc .toc h2 {
  margin: 0 0 0.4rem;
  padding-top: 0;
  border-top: 0;
  line-height: 1.4;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding-left: 1.4rem;
  font-size: 0.9375rem;
}

.toc li {
  margin: 0.15rem 0;
}

.doc h2 {
  margin: 2.25rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 1.375rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.doc h3 {
  margin: 1.5rem 0 0.4rem;
  font-size: 1.0625rem;
  line-height: 1.35;
}

.doc p,
.doc ul,
.doc ol {
  margin: 0 0 0.9rem;
}

.doc ul,
.doc ol {
  padding-left: 1.25rem;
}

.doc li {
  margin: 0 0 0.5rem;
  padding-left: 0.15rem;
}

.role {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.4rem;
  border: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.1em;
  white-space: nowrap;
}

.provider {
  margin: 1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

.provider h3 {
  margin-top: 0;
}

.facts {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0.25rem 0 0.75rem;
}

.facts dt {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.facts dd {
  margin: 0;
}

@media (min-width: 36em) {
  .facts {
    grid-template-columns: 9.5rem 1fr;
    gap: 0.4rem 1rem;
  }

  .facts dt {
    margin-top: 0.1rem;
  }
}

table {
  width: 100%;
  margin: 0.75rem 0 1rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-top: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

thead th {
  border-top: 0;
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody th {
  font-weight: 600;
}

.lang-break {
  margin: 3rem 0 0;
  border: 0;
  border-top: 2px solid var(--ink);
}

/* ---------- print ---------- */

@media print {
  .skip,
  .masthead nav {
    display: none;
  }

  a {
    color: inherit;
  }

  .section,
  .site-foot {
    break-inside: avoid-page;
  }
}
