/* ==========================================================================
   Base
   ========================================================================== */

:root {
  color-scheme: light dark;
}

body {
  display: block;
  margin: 0;
  padding: 0;
  background: white;
  color: black;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.18em;
  line-height: 1.55;
  text-align: justify;
  word-spacing: 0.08em;
  letter-spacing: 0.01em;
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.25em;
  background: #f9f9f9;
  border-left: 2px solid #e9e9e9;
  border-right: 2px solid #e9e9e9;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

p {
  margin: 0 0 1em 0;
}

/* ==========================================================================
   Logo
   ========================================================================== */

.home-logo {
  width: 200px;
  height: 200px;
  margin: 0 auto 0.5em auto;
  background-image: url("/logo.webp");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.home-logo + h1 {
  font-size: 3em;
}

.home-logo + h1::before,
.home-logo + h1::after {
  display: none;
}

h1::before,
h1::after {
  content: "";
  flex: 0 0 auto;
  width: 1.25em;
  height: 1.25em;
  margin: 0;
  background-image: url("/logo.webp");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

nav.pagination,
nav.languages {
  text-align: center;
  text-transform: uppercase;
}

nav.pagination {
  padding: 0.6em 0;
  border-bottom: 2px solid black;
  font-size: 1.05em;
}

body > nav.pagination:last-of-type {
  border-top: 2px solid black;
  border-bottom: none;
}

nav.languages {
  padding: 0.5em 0;
  border-bottom: 2px solid black;
  font-size: 0.75em;
}

nav.pagination a,
nav.pagination span,
nav.languages a {
  margin: 0 0.2em;
  text-decoration: none;
}

.disabled {
  opacity: 0.25;
}

.sep {
  opacity: 0.4;
}

.nav-icon {
  font-size: 0.9em;
  letter-spacing: -0.08em;
}

/* ==========================================================================
   Covers
   ========================================================================== */

.home-cover {
  --cover-max-width: 640px;
  --cover-max-height: 520px;

  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, var(--cover-max-width));
  max-height: var(--cover-max-height);
  object-fit: contain;
  margin: 0 auto 0.85em auto;
  border: 2px solid #ddd;
  box-shadow: 0 0 0.35em rgba(0, 0, 0, 0.18);
}

@media (prefers-color-scheme: dark) {
  .home-cover {
    border-color: #777;
    box-shadow: 0 0 0.35em rgba(0, 0, 0, 0.55);
  }
}

@media (max-width: 600px) {
  .home-cover {
    width: 92%;
    max-width: 320px;
    margin-bottom: 1.5em;
  }
}

@media print {
  .home-cover {
    border-color: #ddd;
    box-shadow: none;
  }
}


/* ==========================================================================
   Headings
   ========================================================================== */

.scene-header {
  margin-bottom: 1.5em;
}

.kicker {
  margin: 0 0 0.25em 0;
  opacity: 0.65;
  font-size: 0.75em;
  text-align: center;
  text-justify: center;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  word-spacing: 0.1em;
}

h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  margin: 0.25em 0 0.75em 0;
  padding-bottom: 0.2em;
  border-bottom: 2px solid #ddd;
  font-size: 2em;
  line-height: 1.15;
  text-align: center;
}

h2 {
  margin-top: 1.5em;
  border-bottom: 2px solid #ddd;
  font-size: 1.45em;
  line-height: 1.2;
  text-align: left;
}

h3 {
  margin-top: 1.5em;
  font-size: 1.2em;
  line-height: 1.2;
  text-align: left;
}

/* ==========================================================================
   Scene content
   ========================================================================== */

.scene hr {
  margin: 2em 0;
  border: none;
  border-top: 2px solid #ddd;
}

article p {
  font-size: 1.1em;
}


/* ==========================================================================
   Generic table-of-contents lists
   ========================================================================== */

.toc-list {
  padding-top: 0.5em;
  text-align: left;
  text-transform: none;
}

.toc-list ol {
  margin: 0;
  padding-left: 1.5em;
}

.toc-list li {
  margin: 0.35em 0;
}


/* ==========================================================================
   Book table of contents
   ========================================================================== */

.chapter-list {
  margin: 0;
  padding-left: 1.5em;
}

.chapter-entry {
  margin: 1em 0;
}

.chapter-title {
  font-weight: 700;
}

.scene-list {
  margin: 0.35em 0 0.75em 0;
  padding-left: 1.5em;
}

.scene-list li {
  margin: 0.25em 0;
}

/* ==========================================================================
   Book status
   ========================================================================== */

.book-status {
  background-color: rgb(from Canvas calc(r * 0.94) calc(g * 0.94) calc(b * 0.94));
  border-bottom: 2px solid #ddd;
  border-top: 2px solid #ddd;
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
  letter-spacing: 0.02em;
  line-height: 1.4;
  margin: 0 auto 1.5em auto;
  max-width: 560px;
  padding: 0.5em 0;
  text-align: center;
  word-spacing: normal;
}

.book-status strong {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.9em;
}

@media (prefers-color-scheme: dark) {
  .book-status {
    border-color: #777;
  }
}

@media (max-width: 600px) {
  .book-status {
    max-width: none;
    margin-bottom: 2em;
    padding: 0.7em 0;
    font-size: 0.9em;
  }
}

@media print {
  .book-status {
    border-color: #ddd;
  }
}

/* ==========================================================================
   Attribution
   ========================================================================== */

.attribs {
  margin-top: 2em;
  padding-top: 0.75em;
  border-top: 2px solid #ddd;
}

.attribs p {
  opacity: 0.55;
  font-size: 0.72em;
  line-height: 1.25;
  text-align: left;
  word-spacing: normal;
  letter-spacing: normal;
}


/* ==========================================================================
   Dark mode
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  body {
    background: black;
    color: white;
  }

  main {
    background: #222;
    border-left-color: #444;
    border-right-color: #444;
  }

  nav.pagination,
  nav.languages {
    border-color: white;
  }

  body > nav.pagination:last-of-type {
    border-color: white;
  }

  h1,
  h2,
  .toc-list,
  .attribs,
  .scene hr {
    border-color: #777;
  }

  .home-logo,
  h1::before,
  h1::after {
    filter: invert(1);
  }
}


/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 600px) {
  body {
    font-size: 1em;
  }

  main {
    max-width: none;
    padding: 0.85em;
    border-left: none;
    border-right: none;
  }

  nav.pagination {
    font-size: 0.95em;
  }

  h1 {
    font-size: 1.55em;
    gap: 0.4em;
  }

  h1::before {
    width: 1.15em;
    height: 1.15em;
  }

  h2 {
    font-size: 1.25em;
  }

  .attribs p {
    font-size: 0.78em;
  }
}


/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  nav,
  .attribs {
    display: none;
  }

  body {
    background: white;
    color: black;
    font-size: 11pt;
  }

  main {
    max-width: none;
    border: none;
    background: white;
  }

  .scene hr {
    border-top-color: #ddd;
  }

  h1::before {
    filter: none;
  }
}
