/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Theme Variables ─────────────────────────────────────── */
:root,
.theme-light {
  --bg: #ffffff;
  --text: #000000;
  --text-muted: #737373;
  --accent: #006ee6;
  --border: #737373;
  --btn-bg: rgba(128, 128, 128, 0.12);
}

.theme-dark {
  --bg: #000000;
  --text: #ffffff;
  --text-muted: #999999;
  --accent: #5fa3ff;
  --border: #999999;
  --btn-bg: rgba(128, 128, 128, 0.12);
}

/* ── Base Styles ─────────────────────────────────────────── */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* ── Top Bar (sticky header) ─────────────────────────────── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  flex-wrap: nowrap;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.site-name {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  overflow: hidden;
}

.site-name a {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  color: var(--text-muted) !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-name a:hover {
  color: var(--accent) !important;
}

.site-name .sep {
  color: var(--text-muted);
  flex-shrink: 0;
}

.top-bar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.theme-toggle,
.lang-toggle {
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.theme-toggle:hover,
.lang-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--btn-bg);
}

.theme-toggle svg,
.lang-toggle svg {
  width: 22px;
  height: 22px;
}

.theme-dark .icon-sun { display: block; }
.theme-dark .icon-moon { display: none; }
.theme-light .icon-sun { display: none; }
.theme-light .icon-moon { display: block; }

/* Flag icons for language toggle */
.lang-toggle .flag-de,
.lang-toggle .flag-en {
  display: none;
  width: 24px;
  height: 24px;
  border-radius: 2px;
}

html[lang="de"] .lang-toggle .flag-de { display: block; }
html[lang="en"] .lang-toggle .flag-en { display: block; }

/* Back-link on sub-pages (gray, not accent) */
.back-link {
  margin-right: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent);
}

/* ── Main Content ────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  color: var(--text);
}

/* ── Extras ───────────────────────────────────────────────── */
.publications {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.publications summary {
  padding: 0.75rem 0;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: color 0.2s ease;
}

.publications summary::marker,
.publication-list li::marker,
.related-publications li::marker {
  color: var(--text-muted);
}

.publications summary:hover {
  color: var(--accent);
}

.publications[open] summary {
  margin-bottom: 0.25rem;
}

.publication-list {
  padding: 0 0 0.75rem 1.25rem;
  font-size: 0.85rem;
  line-height: 1.55;
}

.publication-list a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--text-muted);
  text-underline-offset: 0.15em;
}

.publication-list a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.related-publications {
  margin-top: 0.65rem;
  padding-left: 1.25rem;
}

.doi-reference {
  margin-top: 0.2rem;
  overflow-wrap: anywhere;
}

.pretext-accessible-source {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
  user-select: none;
}

.pretext-loading .pretext-justify {
  visibility: hidden;
}

.pretext-justify {
  text-align: justify;
  hyphens: auto;
}

.pretext-justify[data-pretext-layout="knuth-plass"] {
  text-align: left;
  hyphens: manual;
}

.pretext-line {
  display: block;
  text-align: left;
  white-space: nowrap;
}

.pretext-line--justified {
  text-align: left;
}

.pretext-break-space {
  display: none;
}

.pretext-hyphen::after {
  content: "-";
}

.publication-type {
  display: block;
  margin-bottom: 0.1rem;
  font-weight: 600;
}

.more-soon {
  margin-top: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.not-found-message {
  margin-top: 1rem;
  font-size: 1.1rem;
}

/* ── Social Row (in footer area) ─────────────────────────── */
.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.5rem 0.75rem;
}

.social-row a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s ease;
  white-space: nowrap;
  border: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: none !important;
}

.social-row a:hover {
  color: var(--accent);
  border: none !important;
  background: none !important;
}

.social-row a:hover .icon {
  color: var(--accent);
}

.social-row .icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.social-row .social-indicator {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  cursor: default;
}

.social-row .social-indicator .icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* "auch auf" / "also on" label */
.also-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 0 1.5rem 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-legal {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 0 0;
}

.footer-legal a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-legal a:hover {
  color: var(--accent);
}

.footer-legal .sep {
  color: var(--text-muted);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .top-bar {
    padding: 0.75rem 1rem;
  }

  .site-name,
  .site-name a {
    font-size: 0.65rem;
  }

  main {
    padding: 1.5rem 1rem 3rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .social-row {
    padding: 1rem 1rem 0.5rem;
    gap: 0.4rem 0.8rem;
  }

  .social-row a,
  .also-label {
    font-size: 0.8rem;
  }

  .social-row .icon,
  .social-row .social-indicator .icon {
    width: 18px;
    height: 18px;
  }

  footer {
    padding: 0 1rem 1.5rem;
  }
}

@media (max-width: 400px) {
  .site-name,
  .site-name a {
    font-size: 0.55rem;
  }
}

/* ── Smooth Theme Transition ──────────────────────────────── */
.theme-transitioning {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.theme-transitioning body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Selection ────────────────────────────────────────────── */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ── Focus ────────────────────────────────────────────────── */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
