:root {
  color-scheme: dark;
  --bg: #030304;
  --surface: #0a0a0d;
  --surface-soft: #111116;
  --ink: #f0eee6;
  --muted: #b9b2a6;
  --rule: #d6cfbf;
  --link: #9fcfff;
  --link-hover: #ffb0a4;
  --tome-link: #9fcfff;
  --tome-link-hover: #ffb0a4;
  --night-text: #d7d2c8;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--night-text);
  background-color: var(--bg);
  background-image: url("../images/johannes_lingelbach.webp");
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  font-family: Verdana, Tahoma, "Trebuchet MS", sans-serif;
}

a {
  color: var(--link);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

a:hover,
a:focus-visible {
  color: var(--link-hover);
}

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 0.16rem;
}

.app-shell {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 1.25rem 1.5rem;
}

.site-footer {
  padding: 2.5rem 1.5rem 1.5rem;
  background: linear-gradient(
    to bottom,
    rgba(3, 3, 4, 0),
    rgba(3, 3, 4, 0.82) 58%,
    rgba(3, 3, 4, 0.96)
  );
}

.site-footer p {
  margin: 0 auto;
  width: min(100%, 70rem);
  padding-top: 0.85rem;
  border-top: 1px solid rgba(214, 207, 191, 0.26);
  color: var(--night-text);
  font-size: 0.95rem;
  text-align: center;
}

.site-footer a {
  color: var(--link);
}

.tome {
  position: relative;
  width: min(100%, 70rem);
  margin: auto 0;
  padding: clamp(1rem, 3vw, 2rem);
  border: 0.22rem double rgba(214, 207, 191, 0.78);
  color: var(--ink);
  background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 1.25rem 3rem rgba(0, 0, 0, 0.78),
    inset 0 0 3.5rem rgba(0, 0, 0, 0.58);
}

.tome a {
  color: var(--tome-link);
}

.tome a:hover,
.tome a:focus-visible {
  color: var(--tome-link-hover);
}

.tome::before,
.tome::after {
  position: absolute;
  top: 0.7rem;
  bottom: 0.7rem;
  width: 0.18rem;
  content: "";
  background: linear-gradient(transparent, rgba(214, 207, 191, 0.62), transparent);
}

.tome::before {
  left: 0.7rem;
}

.tome::after {
  right: 0.7rem;
}

.tome-masthead {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.35rem 0.45rem 0.85rem;
  text-align: center;
}

.site-place {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 700;
  text-transform: uppercase;
}

.tome h1 {
  margin: 0.1rem 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.85rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1;
  text-shadow:
    0 0 0.65rem rgba(255, 255, 255, 0.14),
    2px 2px 0 #000;
}

.tome-rule {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.1rem 0 1rem;
  color: var(--rule);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  letter-spacing: 0;
  text-align: center;
}

.tome-rule::before,
.tome-rule::after {
  flex: 1;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--rule), transparent);
}

.tome-grid {
  display: grid;
  gap: 0.85rem;
}

.tome-panel {
  position: relative;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(214, 207, 191, 0.48);
  background: var(--surface-soft);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.055),
    0 0 1.35rem rgba(0, 0, 0, 0.18);
}

.tome-panel h2 {
  position: absolute;
  top: -0.58rem;
  left: 50%;
  max-width: calc(100% - 1.5rem);
  margin: 0;
  padding: 0 0.45rem;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  transform: translateX(-50%);
}

.tome-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.52;
}

.tome-panel p + p {
  margin-top: 0.65rem;
}

.link-panel ul {
  margin: 0;
  padding-left: 1.25rem;
}

.link-panel li {
  line-height: 1.35;
}

.link-panel li + li {
  margin-top: 0.3rem;
}

.contents-panel-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.pantocrator {
  display: block;
  width: clamp(4.5rem, 8vw, 5.5rem);
  height: auto;
  padding: 0.15rem;
  border: 1px solid rgba(214, 207, 191, 0.62);
  background: #050506;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0.45rem 1.2rem rgba(0, 0, 0, 0.55);
}

.link-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  justify-content: center;
}

.web-button {
  display: inline-flex;
  width: 88px;
  height: 31px;
  line-height: 0;
}

.web-button img {
  display: block;
  width: 88px;
  height: 31px;
  image-rendering: pixelated;
}

.book-author {
  color: var(--muted);
}

.book-author::before {
  content: "- ";
}

@media (min-width: 900px) {
  .tome-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .button-panel,
  .local-panel {
    grid-column: 1 / -1;
  }

  .local-panel ul {
    columns: 2;
    column-gap: 2rem;
  }

  .local-panel li {
    break-inside: avoid;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0.9rem 0.75rem;
  }

  .site-footer {
    padding: 0 0.75rem 1rem;
  }

  .tome {
    margin: 0;
    padding: 0.9rem;
  }

  .tome::before,
  .tome::after {
    display: none;
  }

  .tome-masthead {
    justify-content: center;
  }

  .pantocrator {
    width: 4.25rem;
  }

  .tome h1 {
    font-size: clamp(1.7rem, 11vw, 2.6rem);
  }
}
