:root {
  --background: #f5f6fa;
  --card-background: #ffffff;
  --accent: #1d4ed8;
  --accent-muted: #94a3b8;
  --text: #1f2933;
  --text-muted: #475569;
  --border: #e2e8f0;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --header-height: 160px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.site-header {
  background: linear-gradient(135deg, #0f172a, #1d4ed8);
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
}

.site-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: 0.02em;
}

.header-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1rem;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.download-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.18);
}

.view-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.view-option:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.view-option input {
  display: none;
}

.view-option input:checked + .flag-label {
  border-color: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.flag-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(15, 23, 42, 0.2);
  color: #fff;
  font-weight: 600;
}

.flag-label img {
  width: 28px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.flag-label--dual img {
  box-shadow: none;
}

@media (min-width: 768px) {
  .site-header__inner {
    padding: 0.5rem 0;
  }

  .header-controls {
    flex-direction: row;
  }
}

.toc-bar {
  position: sticky;
  top: var(--header-height);
  z-index: 95;
  background: rgba(245, 246, 250, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.08);
}

.glossary-bar {
  background: rgba(245, 246, 250, 0.96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.08);
  margin-bottom: 2rem;
}

.toc-bar__inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
}

.toggle-button {
  align-self: flex-start;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: #fff;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.toggle-button:hover {
  transform: translateY(-1px);
  background: rgba(29, 78, 216, 0.07);
}

.collapse-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.collapse-panel.is-open {
  max-height: 2400px;
}

.toc-list {
  list-style: decimal;
  padding-left: 1.25rem;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.toc-list a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.toc-list a:hover {
  color: var(--accent);
}

.toc-list .is-subsection {
  padding-left: 0.75rem;
}

.section-title {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  color: var(--accent);
}

.site-footer {
  background: #0f172a;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  font-size: 0.9rem;
}


.translation-section {
  background: transparent;
}

.glossary-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: var(--card-background);
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.glossary-content h2,
.glossary-content h3 {
  margin: 0.5rem 0 0.25rem;
  color: var(--accent);
}

.glossary-content p {
  margin: 0;
  line-height: 1.6;
  color: var(--text);
}

.translation-header {
  position: sticky;
  top: calc(var(--header-height) + 60px);
  z-index: 90;
  background: linear-gradient(180deg, var(--background) 0%, rgba(245, 246, 250, 0.85) 100%);
  padding: 0.5rem 0 1rem;
  backdrop-filter: blur(6px);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.paragraph-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem;
  padding: 1.5rem;
  background: var(--card-background);
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.paragraph-pair[data-type="section"],
.paragraph-pair[data-type="subsection"] {
  align-items: baseline;
}

.language-text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  line-height: 1.6;
  font-size: 1rem;
  color: var(--text);
}

.language-text h2,
.language-text h3 {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.language-text h2 {
  font-size: 1.35rem;
}

.language-text h3 {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.language-text p {
  margin: 0;
  text-align: justify;
}

.textcolor-blue {
  color: #2563eb;
}

.textcolor-orange {
  color: #d97706;
}

.textcolor-red {
  color: #dc2626;
  font-weight: 600;
}

.alt-term {
  font-style: italic;
  color: var(--text-muted);
}

.footnotes-section {
  padding-top: 0;
}

.section-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footnotes-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.footnote-entry {
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--card-background);
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: var(--shadow);
}

.footnote-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: rgba(29, 78, 216, 0.1);
  color: var(--accent);
  font-weight: 800;
}

.footnote-ref {
  position: relative;
  color: var(--accent);
  cursor: pointer;
}

.footnote-ref::after {
  content: attr(data-footnote-text);
  position: absolute;
  left: 50%;
  transform: translate(-50%, -8px);
  white-space: normal;
  min-width: 220px;
  max-width: 360px;
  background: #0f172a;
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 50;
}

.footnote-ref:hover::after {
  opacity: 1;
  transform: translate(-50%, -12px);
}

@media (max-width: 900px) {
  .paragraph-pair {
    grid-template-columns: 1fr;
  }

  .footnote-entry {
    grid-template-columns: 60px 1fr;
    grid-template-areas:
      'label label'
      'da de';
  }

  .footnote-label {
    width: 50px;
    height: 50px;
    justify-self: center;
  }
}

#content[data-mode="da"] .paragraph-pair,
#content[data-mode="de"] .paragraph-pair {
  grid-template-columns: 1fr;
}

#content[data-mode="da"] .lang-de,
#content[data-mode="de"] .lang-da {
  display: none;
}

@media (max-width: 900px) {
  .paragraph-pair {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .site-header__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .view-toggle {
    align-self: center;
    flex-wrap: wrap;
    justify-content: center;
  }
}
