/*
 * The site around the journal: the page is one sheet of the Hy-Brasil journal (css/hy-brasil.css,
 * copied from the Foundry module) on a white ground, plus the header, contents, footer and the
 * image viewer (js/lightbox.js).
 */

html {
  background: var(--hb-paper, #fff);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body.hy-brasil-journal {
  margin: 0;
  padding: 0.5rem 1rem 2rem;
  background: var(--hb-paper, #fff);
}

.site-sheet {
  box-sizing: border-box;
  max-width: 54rem;
  margin: 0 auto;
  padding: 0.5rem 2.5rem 2rem;
  background: var(--hb-paper);
  font-family: var(--hb-font-body);
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--hb-ink);
}

.site-header {
  border-bottom: 3px solid var(--hb-frame);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
}

.site-title {
  font-family: var(--hb-font-gothic);
  font-size: 3.4em;
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
}

.site-subtitle {
  font-size: 1.2em;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  margin: 0;
}

.site-cover {
  margin: 0 0 1rem;
}

.site-intro p {
  margin: 0 0 0.75rem;
}

/* The site's own figures (cover and map): a centred caption in italic. */
.site-cover figcaption,
.site-map figcaption {
  font-style: italic;
  text-align: center;
}

.hy-brasil-journal .journal-entry-page {
  font-size: 1em;
  scroll-margin-top: 1rem;
}

.hy-brasil-journal .journal-entry-page .journal-page-header h1 {
  text-align: center;
}

.site-footer {
  border-top: 3px solid var(--hb-frame);
  color: var(--hb-ink-muted);
  font-size: 0.85em;
  margin-top: 2rem;
  padding-top: 0.75rem;
  text-align: center;
}

.site-footer p {
  margin: 0 0 0.4rem;
}

/* The Free League "A Supplement for Dragonbane" logo, required by the third-party licence. */
.site-footer .site-dragonbane {
  display: block;
  width: 14rem;
  max-width: 60%;
  height: auto;
  margin: 0.5rem auto 1rem;
}

/* Foundry's core styles bound images to their column; outside Foundry, do it here. */
.site-sheet img {
  max-width: 100%;
  height: auto;
}

/* Images open in the viewer. */
.site-sheet figure img {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  box-sizing: border-box;
  background: rgba(10, 10, 10, 0.92);
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 4rem);
  object-fit: contain;
  border: 3px solid var(--hb-paper);
  background: var(--hb-paper);
}

.lightbox button {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  border: 0;
  background: none;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 40rem) {
  body.hy-brasil-journal {
    padding: 0;
  }

  .site-sheet {
    padding: 1rem 1rem 1.5rem;
  }

  .site-title {
    font-size: 2.6em;
  }

  /* The path tables' longest entries (Magic Talent (Mentalism)) would push past a phone's width. */
  .hy-brasil table.hb-paths {
    font-size: 0.9em;
    table-layout: fixed;
    width: 100%;
  }

  .hy-brasil table.hb-paths thead th,
  .hy-brasil table.hb-paths tbody th,
  .hy-brasil table.hb-paths tbody td,
  .hy-brasil table.hb-paths td:last-child {
    overflow-wrap: anywhere;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    white-space: normal;
    width: auto;
  }
}

.site-footer a {
  color: inherit;
}
