/* Halvfet och fet ligger som egna fasta typsnittsfiler så att fetstil visas även i iPhone och iPad. */
/* Kosmologika: gemensamt utseende (Observatoriet med typsnitten Exo 2 och Inter). */
/* Samma design som provades på Galaxer, för hela webbplatsen utom /Galaxer/, */
/* som har kvar sin egen galaxer.css. Laddas efter stilmall.css och sidornas egna stilar. */
/* Samma logga som Galaxer: /kosmologika-logo.svg i toppmenyn (byts av /utseende.js) och i sidfoten. */

@font-face {
  font-family: "Exo 2";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/exo2-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Exo 2";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/exo2-latin-600.woff2") format("woff2");
}

@font-face {
  font-family: "Exo 2";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/exo2-latin-700.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/inter-latin-600.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/inter-latin-700.woff2") format("woff2");
}

:root {
  --gx-lila: #800080;
  --gx-mork: #2a1450;
  --gx-mellan: #5b2a8c;
  --gx-bakgrund: #f7f4fb;
  --gx-kant: #e4d8f0;
  --gx-text: #231a30;
}

body {
  background: var(--gx-bakgrund);
  color: var(--gx-text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

p, li, td, th, dd, dt, blockquote {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

h1, h2, h3, h4, h5 {
  font-family: "Exo 2", "Inter", system-ui, sans-serif;
  color: var(--gx-lila);
  line-height: 1.25;
}

h2 { font-size: 1.6rem; font-weight: 600; margin: 1.6em 0 0.5em; }
h3 { font-size: 1.3rem; font-weight: 600; }
h4 { font-size: 1.12rem; font-weight: 600; }
h5 { font-size: 1rem; font-weight: 600; }

a { color: var(--gx-mellan); }
a:hover { color: var(--gx-lila); }

/* Sidrubriken: mörklila band med rundade nederhörn */
body > h1,
body > div[itemscope] > h1 {
  margin: 0 0 2rem;
  padding: 3.2rem 1.25rem 2.8rem;
  background: linear-gradient(180deg, #2a1450, #5b2a8c);
  border-radius: 0 0 40px 40px;
  color: #fff !important;
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: break-word;
  hyphens: auto;
}
body > h1 a,
body > h1 a:link,
body > h1 a:visited,
body > div[itemscope] > h1 a { color: #fff; text-decoration: none; }

/* Titelgrafiken (GIF) ersätts i bandet av rubrikens text. Bildfilerna och koden finns kvar. */
body > h1.sidtitel img,
body > div[itemscope] > h1.sidtitel img { display: none; }
body > h1.sidtitel .dold-text,
body > div[itemscope] > h1.sidtitel .dold-text {
  position: static !important;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Startsidan behåller loggan och sin layout, utan band */
body.startsida > h1 {
  margin: 0.6em 0 0.4em;
  padding: 0;
  background: none;
  border-radius: 0;
  font-size: 26px;
}
body.startsida > h1 img { border-radius: 0; }

/* Kapitelsidor: sidlista och artikel som kort */
body > div.kapitelsida {
  max-width: none;
  margin: 0 auto;
  padding: 0;
}

body > div.kapitelsida > table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 1.5rem 0;
}

body > div.kapitelsida > table > tbody > tr > td {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(80, 30, 120, 0.12);
  border-top: 4px solid var(--gx-lila);
  padding: 1.25rem 1.75rem 1.75rem;
}

body > div.kapitelsida > table > tbody > tr > td:first-child {
  width: 15rem;
  padding: 1rem 1.1rem 1.25rem;
}

body > div.kapitelsida > table > tbody > tr > td:first-child > h2,
body > div.kapitelsida > table > tbody > tr > td:first-child > h3,
body > div.kapitelsida > table > tbody > tr > td:first-child > .meny-rubrik {
  margin: 0.3rem 0 0.8rem;
  font-family: "Exo 2", "Inter", system-ui, sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
}

body > div.kapitelsida > table > tbody > tr > td:first-child > h2 a,
body > div.kapitelsida > table > tbody > tr > td:first-child > h3 a,
body > div.kapitelsida > table > tbody > tr > td:first-child > .meny-rubrik a { color: var(--gx-lila); text-decoration: none; }

body > div.kapitelsida > table > tbody > tr > td:first-child ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

body > div.kapitelsida > table > tbody > tr > td:first-child li {
  font-size: 0.95rem;
  line-height: 1.35;
}

body > div.kapitelsida > table > tbody > tr > td:first-child li a {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  text-decoration: none;
}

body > div.kapitelsida > table > tbody > tr > td:first-child li a:hover { background: #f7f2fb; }

/* Aktuell sida i sidlistan */
body > div.kapitelsida > table > tbody > tr > td:first-child li b { font-weight: inherit; }
body > div.kapitelsida > table > tbody > tr > td:first-child li a[aria-current="page"],
body > div.kapitelsida > table > tbody > tr > td:first-child li a[aria-current="page"]:hover {
  font-weight: 700;
  color: var(--gx-mork);
  background: #eee2f7;
  box-shadow: inset 3px 0 0 var(--gx-lila);
}
body > div.kapitelsida > table > tbody > tr > td:first-child li a:focus-visible {
  outline: 3px solid var(--gx-mellan);
  outline-offset: 2px;
}

body > div.kapitelsida > table > tbody > tr > td:last-child { max-width: none; }

body > div.kapitelsida > table > tbody > tr > td:last-child > :first-child { margin-top: 0.4rem; }

img { max-width: 100%; height: auto; border-radius: 6px; }

blockquote {
  border-left: 4px solid var(--gx-kant);
  margin-left: 0;
  padding: 0.2rem 0 0.2rem 1rem;
  color: #3d2f50;
}

/* Knappen som fäller ut sidlistan på smala skärmar (skapas av sidan eller /utseende.js) */
.ab-index-toggle { display: none; }
.ab-index-toggle, .aidx-index-toggle, .ig-index-toggle { font-family: "Inter", sans-serif; border-radius: 999px !important; }

@media (max-width: 900px) {
  body > div.kapitelsida > table,
  body > div.kapitelsida > table > tbody,
  body > div.kapitelsida > table > tbody > tr,
  body > div.kapitelsida > table > tbody > tr > td {
    display: block;
    overflow: visible;
  }
  body > div.kapitelsida > table { border-spacing: 0; width: auto; margin: 0; }
  body > div.kapitelsida > table > tbody > tr > td,
  body > div.kapitelsida > table > tbody > tr > td:first-child { width: auto; margin-bottom: 1rem; overflow-wrap: break-word; }
  body > div.kapitelsida td.ab-index,
  body > div.kapitelsida td.aidx-index,
  body > div.kapitelsida td.ig-index { border-bottom: 0 !important; }
  .ab-index-toggle {
    display: inline-block; background: #fff; color: #800080;
    border: 1px solid #800080;
    padding: 0.35rem 0.8rem; font-size: 0.95rem; cursor: pointer;
  }
  td.ab-index:not(.ab-open) > ul { display: none; }
  td.ab-index > ul { columns: 3 11rem; column-gap: 1.5rem; margin-top: 0.6rem; }
  td.ab-index > ul > li { break-inside: avoid; }
  /* Tabeller i artikeln: rullar i sidled inuti sig själva, inte hela sidan */
  body > div.kapitelsida > table td table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  body > h1,
  body > div[itemscope] > h1 { padding: 2.2rem 1rem 2rem; border-radius: 0 0 28px 28px; margin-bottom: 1.2rem; }
  body.startsida > h1 { padding: 0; margin: 0.6em 0 0.4em; font-size: 1.4rem; }
  body > div.kapitelsida { padding: 0 0.6rem; }
  body > div.kapitelsida > table > tbody > tr > td { padding: 1rem 1rem 1.25rem; }
  h2 { font-size: 1.35rem; }
  td.ab-index > ul { columns: 2; hyphens: auto; }
}

@media (min-width: 901px) {
  /* Full bredd: rutorna linjerar med titelrutan, mellanrum bara mellan rutorna */
  body > div.kapitelsida > table,
  body > div.kapitelsida > table > tbody { display: block; width: 100%; border-spacing: 0; }
  body > div.kapitelsida > table > tbody > tr { display: flex; gap: 1.5rem; align-items: stretch; }
  body > div.kapitelsida > table > tbody > tr > td { display: block; box-sizing: border-box; }
  body > div.kapitelsida > table > tbody > tr > td:first-child { flex: 0 0 15rem; }
  body > div.kapitelsida > table > tbody > tr > td:last-child { flex: 1 1 auto; min-width: 0; }
}

/* Sidfoten: full bredd som rubrikytan. Logga och Nästa sida överst, */
/* upphovsrätt, e-post och datum centrerat under. */
footer.sidfot {
  max-width: none;
  margin: 2rem 0 0;
  padding: 0.6rem 1.25rem 1.5rem;
  color: #5a4a6e;
}
footer.sidfot img { border-radius: 0; }
footer.sidfot .sidfot-rad {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1rem;
}
footer.sidfot .sidfot-hem { order: 1; padding: 0.2rem 0 0.9rem; }
footer.sidfot .sidfot-nasta { order: 2; margin: 0 0 0.9rem auto; }
footer.sidfot .sidfot-copy {
  order: 3;
  flex: 1 0 100%;
  margin: 0 -1.25rem;
  padding: 0.8rem 1.25rem 0;
  border-top: 1px solid #e6d6ee;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #777777;
}
footer.sidfot .sidfot-rad > .uppdaterad { order: 4; flex: 1 0 100%; }
footer.sidfot .uppdaterad {
  margin: 0.15rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #777777;
}
footer.sidfot a.sidfot-nasta,
footer.sidfot a.sidfot-nasta:link,
footer.sidfot a.sidfot-nasta:visited {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--gx-lila);
  color: #fff;
  font-family: "Exo 2", "Inter", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}
footer.sidfot a.sidfot-nasta::after { content: " \2192"; }
footer.sidfot a.sidfot-nasta:hover,
footer.sidfot a.sidfot-nasta:focus { background: var(--gx-mellan); color: #fff; }

@media (max-width: 640px) {
  footer.sidfot .sidfot-rad { flex-direction: column; align-items: stretch; text-align: center; }
  footer.sidfot .sidfot-hem { align-self: center; padding-top: 0.4rem; }
  footer.sidfot a.sidfot-nasta { display: block; width: 100%; max-width: 20rem; align-self: center; margin: 0 auto 0.9rem; text-align: center; }
}

@media print {
  body { background: #fff; }
  body > h1, body > div[itemscope] > h1 { background: none; color: var(--gx-lila) !important; padding: 0; }
  body > div.kapitelsida > table > tbody > tr > td { box-shadow: none; border-top: 0; }
}

/* Logga (som på Galaxer): toppmeny 32 px, sidfot 24 px */
.site-header .site-mark img { height: 32px; max-width: none; }
.sidfot-hem img { height: 24px; }
body.startsida > h1 img { width: 417px; max-width: 100%; height: auto; }

/* Aktuellt avsnitt i toppmenyn: fetstil och, på smal skärm, en lila kant till vänster.
   aria-current sätts av /nav.js. Regeln behövs särskilt i Safari på iPhone och iPad,
   där enbart inline-fetstil inte alltid syns. */
.site-nav a[aria-current],
.site-nav a[aria-current]:visited {
  font-weight: 700 !important;
  color: #800080;
}
@media (max-width: 959px) {
  .site-nav a[aria-current] {
    border-left: 4px solid #800080;
    padding-left: 0.6rem;
  }
}
@media (min-width: 960px) {
  .site-nav a[aria-current],
  .site-nav a[aria-current]:visited {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
  }
}
