/* ============================================
   I Rikets Tjänst – GitHub Pages Theme
   Cold War aesthetic: navy, gold, cream, Georgia
   ============================================ */

/* Reset & base */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.6;
  color: #1a1a1a;
  background-color: #f5f5f0;
  margin: 0;
  padding: 0;
}

/* ---- Header ---- */
.site-header {
  background-color: #1b3a4b;
  border-bottom: 3px solid #c5a44e;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-logo img {
  height: 40px;
  width: 40px;
  object-fit: contain;
  display: block;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
}

.site-nav a {
  color: #d4c9a8;
  text-decoration: none;
  font-variant: small-caps;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  transition: color 0.2s;
}

.site-nav a:hover {
  color: #c5a44e;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin-left: auto;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #d4c9a8;
  margin: 5px 0;
  transition: 0.3s;
}

/* ---- Main content ---- */
.content {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

article {
  background: #fafafa;
  padding: 2.5rem 3rem;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border-top: 3px solid #c5a44e;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  color: #1b3a4b;
  line-height: 1.25;
}

h1, .page-title {
  font-size: 2rem;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  margin-top: 0;
  margin-bottom: 0.5em;
  padding-bottom: 0.4em;
  border-bottom: 3px solid #1b3a4b;
}

/* Avoid double h1 when page-title is shown */
article > h1:first-child {
  display: none;
}

h2 {
  font-size: 1.35rem;
  margin-top: 2em;
  margin-bottom: 0.5em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid #c5a44e;
}

h3 {
  font-size: 1.1rem;
  margin-top: 1.5em;
  margin-bottom: 0.4em;
}

h4, h5, h6 {
  font-size: 1rem;
  margin-top: 1.2em;
  margin-bottom: 0.3em;
}

p {
  margin-top: 0.4em;
  margin-bottom: 0.6em;
}

a {
  color: #1b3a4b;
  text-decoration: underline;
  text-decoration-color: #c5a44e;
  text-underline-offset: 2px;
}

a:hover {
  color: #c5a44e;
}

a > img {
  text-decoration: none;
}

a:has(> img) {
  text-decoration: none;
}

/* ---- Lists ---- */
ul, ol {
  margin-top: 0.3em;
  margin-bottom: 0.6em;
  padding-left: 1.8em;
}

li {
  margin-bottom: 0.25em;
}

li > ul, li > ol {
  margin-top: 0.2em;
  margin-bottom: 0.2em;
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.9rem;
}

thead {
  background-color: #1b3a4b;
  color: #fff;
}

th {
  padding: 0.5em 0.75em;
  text-align: left;
  font-weight: bold;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}

td {
  padding: 0.45em 0.75em;
  border-bottom: 1px solid #ddd;
}

tr:nth-child(even) {
  background-color: #f5f5f0;
}

/* ---- Blockquotes ---- */
blockquote {
  margin: 1em 0;
  padding: 0.8em 1.2em;
  border-left: 4px solid #1b3a4b;
  background-color: #f0efe8;
  font-style: italic;
  color: #333;
}

blockquote p {
  margin: 0.3em 0;
}

/* ---- Code ---- */
code {
  font-family: "Courier New", monospace;
  font-size: 0.85em;
  background-color: #eae9e0;
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background-color: #1b3a4b;
  color: #d4c9a8;
  padding: 1em 1.2em;
  border-radius: 3px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* ---- Images ---- */
article img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ccc;
  outline: 3px solid #f0f0e8;
  outline-offset: -1px;
  padding: 3px;
  background: #fff;
  border-radius: 2px;
}

/* Character portrait-style images: float right */
article img[src*="Bilder/"],
article img[src*="SLP/"] {
  float: right;
  width: 220px;
  margin: 0 0 1em 1.5em;
}

/* ---- Horizontal rules ---- */
hr {
  border: none;
  border-top: 1px solid #c5a44e;
  margin: 2em 0;
}

/* ---- Table of Contents (index page) ---- */
.toc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2.5rem;
  margin-top: 1.5rem;
}

.toc-section {
  break-inside: avoid;
}

.toc-section h3 {
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: #1b3a4b;
  border-bottom: 2px solid #c5a44e;
  padding-bottom: 0.3em;
  margin-top: 0;
  margin-bottom: 0.5em;
  font-size: 1.1rem;
}

.toc-section ul {
  list-style: none;
  padding-left: 0;
}

.toc-section li {
  margin-bottom: 0.35em;
  padding-left: 0.8em;
  position: relative;
}

.toc-section li::before {
  content: "\2014";
  position: absolute;
  left: 0;
  color: #c5a44e;
  font-size: 0.8em;
}

.toc-section a {
  text-decoration: none;
  color: #1b3a4b;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.toc-section a:hover {
  color: #c5a44e;
  border-bottom-color: #c5a44e;
}

/* Intro text on index */
.intro {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #333;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #ddd;
}

.intro strong {
  color: #1b3a4b;
}

/* Title rule decoration */
.title-rule {
  width: 100%;
  border-top: 2px solid #c5a44e;
  border-bottom: 1px solid #1b3a4b;
  height: 4px;
  margin: 0.5em 0 1.5em 0;
}

/* ---- Footer ---- */
.site-footer {
  background-color: #1b3a4b;
  color: #8a9aa8;
  border-top: 3px solid #c5a44e;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.2rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  font-variant: small-caps;
  letter-spacing: 0.08em;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  article {
    padding: 1.5rem 1.2rem;
  }

  .toc-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .site-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1b3a4b;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #c5a44e;
  }

  .site-nav.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .site-logo {
    min-width: 0;
    flex-shrink: 1;
  }

  .site-logo img {
    height: 36px;
    width: 36px;
  }

  article img[src*="Bilder/"],
  article img[src*="SLP/"] {
    float: none;
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 1em auto;
  }

  h1, .page-title {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }

  article {
    padding: 1rem;
    border-radius: 0;
    box-shadow: none;
  }

  .content {
    padding: 1rem 0.5rem 3rem;
  }
}
