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

@font-face {
  font-display: swap;
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 400;
  src: url("../fonts/OpenSans-Regular.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 700;
  src: url("../fonts/OpenSans-Bold.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --bg: #fff;
  --surface: #ffffff;
  --ink: #18201b;
  --muted: #687068;
  --line: #d9ded5;
  --accent: #cd1d04;
  --accent-strong: #a81703;
  --shadow: 0 18px 50px rgba(26, 35, 30, 0.12);
  --font-headline: "Praktika", Georgia, serif;
  --font-body: "Open Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 22px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--font-headline);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.intro {
  max-width: 540px;
  margin: 2rem auto 1rem auto;
  padding: 0 1rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.button,
.icon-button,
.reader-mode-button {
  appearance: none;
  border: 1px solid transparent;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 6px;
  font-weight: 700;
  white-space: nowrap;
}

.button-primary {
  background: var(--accent);
  color: #ffffff;
}

.button-primary:hover {
  background: var(--accent-strong);
}

.reader-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 38px;
}

.reader-panel {
  position: relative;
  overflow: hidden;
  min-height: 68vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

body.has-reader-mode {
  overflow: hidden;
}

body.has-zoom-overlay {
  overflow: hidden;
}

.reader-panel:fullscreen,
.reader-panel:-webkit-full-screen,
.reader-panel.is-reader-mode {
  display: grid;
  grid-template-rows: 1fr auto;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background: #eef2ed;
  box-shadow: none;
}

.reader-panel.is-reader-mode {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.reader-panel:fullscreen .book-stage,
.reader-panel:-webkit-full-screen .book-stage,
.reader-panel.is-reader-mode .book-stage {
  min-height: 0;
  padding: 22px 20px;
}

.reader-panel:fullscreen .reader-controls,
.reader-panel:-webkit-full-screen .reader-controls,
.reader-panel.is-reader-mode .reader-controls {
  min-height: 64px;
}

.reader-panel:fullscreen .reader-status,
.reader-panel:-webkit-full-screen .reader-status,
.reader-panel.is-reader-mode .reader-status {
  inset: 18px auto auto 18px;
}

.reader-status {
  position: absolute;
  inset: 18px auto auto 18px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 0.88rem;
  backdrop-filter: blur(10px);
}

.reader-status[hidden] {
  display: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #c9d0c8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.book-stage {
  display: grid;
  min-height: 64vh;
  padding: 58px 28px 28px;
  overflow: auto;
  place-items: center;
  background:
    linear-gradient(90deg, rgba(205, 29, 4, 0.06), transparent 26%, transparent 74%, rgba(205, 29, 4, 0.06)),
    #eef2ed;
}

.flipbook {
  width: min(100%, 1080px);
}

.book-page {
  overflow: hidden;
  background: #ffffff;
}

.book-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  user-select: none;
}

.reader-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 10px;
}

.zoom-overlay[hidden] {
  display: none;
}

.zoom-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 25, 21, 0.8);
}

.zoom-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  width: min(98vw, 1180px);
  height: min(96dvh, 1040px);
  max-height: 96dvh;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(25, 31, 27, 0.92);
}

.zoom-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.zoom-button {
  appearance: none;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.zoom-button:hover:not(:disabled) {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.zoom-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.zoom-close {
  margin-left: 6px;
}

.zoom-level {
  min-width: 74px;
  color: #ffffff;
  text-align: center;
  font-size: 0.92rem;
}

.zoom-canvas-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  overflow: auto;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  min-height: 0;
  padding: 10px;
}

.zoom-canvas-wrap canvas {
  display: block;
  background: #ffffff;
  max-width: none;
  max-height: none;
  height: auto;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-color: var(--line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
}

.reader-mode-button {
  min-height: 42px;
  padding: 0 14px;
  border-color: var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
}

.reader-mode-button:hover:not(:disabled),
.reader-mode-button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.reader-mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.icon-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.page-output {
  min-width: 122px;
  color: var(--muted);
  font-size: 0.94rem;
  text-align: center;
}

.text-link {
  margin-left: 8px;
  color: var(--accent);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.link-stage {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 28px 0 18px;
}

.stage-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.stage-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.site-footer {
  display: grid;
  gap: 18px;
  justify-items: center;
  padding: 24px 0 38px;
}

.footer-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 3rem 0;
}

.footer-logos a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer-logos img {
  display: block;
  width: auto;
}

.footer-logos .logo-juist {
  width: 96px;
  height: 96px;
}

.footer-logos .logo-stiftung {
  width: auto;
  height: 92px;
  object-fit: contain;
}

.legal-links {
  display: flex;
  justify-content: center;
  gap: 38px;
  color: var(--muted);
  font-size: 0.82rem;
}

.legal-links a {
  text-decoration: none;
}

.legal-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.fallback {
  display: grid;
  gap: 18px;
  padding: 26px;
}

.fallback[hidden] {
  display: none;
}

.fallback p {
  margin: 0;
  color: var(--muted);
}

.pdf-embed {
  width: 100%;
  height: min(76vh, 820px);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.no-script {
  margin: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 24px;
  }

  .button {
    width: 100%;
  }

  .reader-shell {
    width: 100%;
    margin-bottom: 0;
  }

  .reader-panel {
    min-height: calc(100vh - 180px);
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .reader-panel:fullscreen .book-stage,
  .reader-panel:-webkit-full-screen .book-stage,
  .reader-panel.is-reader-mode .book-stage {
    padding: 14px 8px;
  }

  .book-stage {
    min-height: 64vh;
    padding: 62px 10px 18px;
  }

  .reader-controls {
    flex-wrap: wrap;
    gap: 10px;
  }

  .zoom-dialog {
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    border-radius: 0;
    border: 0;
    padding: 8px;
  }

  .zoom-toolbar {
    justify-content: flex-start;
  }

  .zoom-button {
    min-height: 36px;
    padding: 0 10px;
  }

  .zoom-close {
    margin-left: auto;
  }

  .zoom-canvas-wrap {
    min-height: 0;
    padding: 6px;
  }

  .text-link {
    width: 100%;
    margin-left: 0;
    text-align: center;
  }

  .reader-mode-button {
    flex: 1 1 130px;
  }

  .link-stage {
    padding: 22px 16px 12px;
  }

  .stage-button {
    width: 100%;
  }

  .footer-logos {
    flex-direction: column;
    gap: 18px;
  }

  .footer-logos .logo-juist {
    width: 118px;
    height: 118px;
  }

  .footer-logos .logo-stiftung {
    height: 84px;
  }
}
