/* Regulatoriskt – design enligt designbrief.md */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #FBFAF8;
  --paper: #FFFFFF;
  --ink: #1B1B1F;
  --muted: #5C5C63;
  --rule: #E7E3DB;
  --accent: #1C3D5A;
  --accent-deep: #142C42;
  --accent-tint: #EDF1F4;
  --on-accent: #FFFFFF;
  --maxw-text: 40rem;
  --maxw-wide: 66rem;
  --space: clamp(1.5rem, 4vw, 3rem);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.7;
  font-feature-settings: "kern";
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(2rem, 5.2vw, 3.1rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); margin-top: 1.8em; }
h3 { font-size: 1.2rem; margin-top: 1.6em; }

p { margin: 0 0 1.2em; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

img { max-width: 100%; height: auto; }

/* ---------- Layout ---------- */

.wrap { max-width: var(--maxw-wide); margin: 0 auto; padding: 0 var(--space); }
.wrap-text { max-width: var(--maxw-text); margin: 0 auto; padding: 0 var(--space); }

main { display: block; padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(3rem, 8vw, 6rem); }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--on-accent);
  padding: 0.6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.site-header .wrap {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding-top: 1.4rem; padding-bottom: 1.4rem; flex-wrap: wrap;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.wordmark .dot {
  display: inline-block;
  width: 0.42em; height: 0.42em;
  background: var(--accent);
  margin-left: 0.12em;
  vertical-align: baseline;
}
.site-nav { display: flex; gap: 1.5rem; font-size: 1rem; }
.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--bg);
  font-size: 0.95rem;
  color: var(--muted);
}
.site-footer .wrap { padding-top: 2.5rem; padding-bottom: 3rem; }
.site-footer p { margin: 0 0 0.4em; }
.site-footer a { color: var(--muted); }
.site-footer .foot-name { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); }

/* ---------- Hero ---------- */

.hero { padding: clamp(1rem, 3vw, 2rem) 0 clamp(2rem, 5vw, 3.5rem); }
.hero h1 { max-width: 20ch; }
.hero .lead { font-size: 1.22rem; color: var(--muted); max-width: 46ch; }

/* ---------- Article covers ---------- */

.cover {
  display: flex; flex-direction: column; justify-content: center;
  background: var(--accent);
  color: var(--on-accent);
  padding: 1.6rem;
  min-height: 9.5rem;
  border-radius: 2px;
}
.cover .cover-stat {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.6vw, 2.2rem);
  line-height: 1.1;
}
.cover .cover-label {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #BFD0DD;
  margin-top: 0.5rem;
}
.cover.cover-lg { min-height: 15rem; padding: 2.2rem; }
.cover.cover-lg .cover-stat { font-size: clamp(2rem, 5vw, 3rem); }

/* ---------- Cards / lists ---------- */

.featured {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
  padding: 2.2rem 0 2.6rem;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.featured > div { align-self: center; }
.featured .kicker { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 0.6rem; }
.featured h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); margin-top: 0; }
.featured p { color: var(--muted); }
.featured a.more { font-weight: 500; text-decoration: none; }
.featured a.more:hover { text-decoration: underline; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: clamp(2.5rem, 6vw, 4rem) 0 1.2rem; gap: 1rem;
  border-bottom: 1px solid var(--rule); padding-bottom: 0.6rem;
}
.section-head h2 { margin: 0; font-size: 1.3rem; }
.section-head a { font-size: 0.95rem; text-decoration: none; }

.article-list { list-style: none; margin: 0; padding: 0; }
.article-list li { padding: 1.4rem 0; border-bottom: 1px solid var(--rule); }
.article-list li:first-child { padding-top: 0.6rem; }
.article-list .a-theme { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--accent); }
.article-list h3 { font-size: 1.3rem; margin: 0.35rem 0 0.4rem; }
.article-list h3 a { text-decoration: none; color: var(--ink); }
.article-list h3 a:hover { color: var(--accent); }
.article-list p { margin: 0; color: var(--muted); font-size: 1.02rem; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.2rem; margin-top: 1rem; }
.theme-card {
  border: 1px solid var(--rule); border-radius: 2px; padding: 1.4rem;
  background: var(--paper); text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; gap: 0.4rem;
}
.theme-card:hover { border-color: var(--accent); }
.theme-card h3 { margin: 0; font-size: 1.15rem; }
.theme-card p { margin: 0; font-size: 0.98rem; color: var(--muted); }
.theme-card .count { font-size: 0.85rem; color: var(--muted); margin-top: auto; padding-top: 0.6rem; }

/* ---------- Article page ---------- */

.breadcrumb { font-size: 0.9rem; color: var(--muted); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--muted); }

article.post { }
article.post h1 { max-width: 22ch; }
article.post .lead {
  font-size: 1.3rem; line-height: 1.55; color: var(--ink);
  margin: 0 0 1.6rem; font-family: var(--serif); font-weight: 400;
}
article.post .post-meta { font-size: 0.9rem; color: var(--muted); margin-bottom: 2.2rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--rule); }
article.post .post-cover { margin: 0 0 2.2rem; }
article.post h2 { }
article.post p, article.post ul { }
article.post ul { padding-left: 1.2rem; margin: 0 0 1.2em; }
article.post li { margin-bottom: 0.5em; }
article.post .exercise {
  background: var(--accent-tint);
  border-left: 3px solid var(--accent);
  padding: 1.4rem 1.6rem;
  margin: 2.2rem 0 0;
}
article.post .exercise h2 { margin-top: 0; font-size: 1.2rem; }
article.post .exercise p:last-child { margin-bottom: 0; }

.post-foot { margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--rule); font-size: 0.95rem; color: var(--muted); }

.siblings { margin-top: 3.5rem; }
.siblings h2 { font-size: 1.15rem; border-bottom: 1px solid var(--rule); padding-bottom: 0.5rem; }

/* ---------- Prose pages ---------- */
.prose { }
.prose h2 { font-size: 1.4rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.5em; }

/* ---------- 404 ---------- */
.err { text-align: center; padding: 3rem 0; }
.err h1 { font-size: clamp(2.5rem, 8vw, 4rem); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  body { font-size: 1.06rem; }
  .featured { grid-template-columns: 1fr; }
  .featured .cover { order: -1; }
  .site-header .wrap { gap: 0.6rem; }
  .site-nav { gap: 1.1rem; }
  article.post .lead { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
