/* Small additions on top of the original Gruve Pro theme styles.
   Keep this file short: the look comes from the theme files in /templates. */

/* "Go to top" button: centred at the bottom, fades in after scrolling
   (the old site did this with JavaScript). */
#jsn-gotoplink {
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, color 0.3s linear, background 0.3s ease-out;
}
#jsn-gotoplink.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Let pictures shrink on small screens instead of overflowing. */
#jsn-page img {
  max-width: 100%;
  height: auto;
}

/* ---- Pages written in Markdown (src/content/pages) ----
   The old pages set sizes and alignment by hand on every paragraph.
   These rules give the same look automatically:
     # Heading   -> big centred page title (old "x-large", 24px)
     ## Heading  -> section heading (old "large", 18px)
     plain text  -> normal body text (old "medium", 16px)
   ("#jsn-page" makes these win over the theme's own heading styles.)   */
#jsn-page .md-page p,
#jsn-page .md-page li,
#jsn-page .md-page td {
  font-size: 16px;
  line-height: 1.5;
}
#jsn-page .md-page p {
  margin: 0 0 10px;
}
#jsn-page .md-page h1,
#jsn-page .md-page h2,
#jsn-page .md-page h3 {
  font-family: inherit;
  font-weight: normal;
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.5;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}
#jsn-page .md-page h1 {
  font-size: 24px;
}
/* The first big heading is the page title: centred. */
#jsn-page .md-page h1:first-of-type {
  text-align: center;
}
#jsn-page .md-page h2 {
  font-size: 18px;
}
#jsn-page .md-page h3 {
  font-size: 16px;
  font-weight: bold;
}
/* A picture on a line of its own is centred, like on the old pages.
   Put it inside <div class="left"> ... </div> to keep it on the left. */
#jsn-page .md-page p > img:only-child,
#jsn-page .md-page p > a:only-child > img:only-child,
#jsn-page .md-page > img,
#jsn-page .md-page > a > img,
#jsn-page .md-page .center > img {
  display: block;
  margin: 0 auto 5px;
}
#jsn-page .md-page .left p > img:only-child,
#jsn-page .md-page .left p > a:only-child > img:only-child,
#jsn-page .md-page .left > img {
  margin-left: 0;
}
#jsn-page .md-page .left h1 {
  text-align: left;
}
/* Wrap part of a page in <div class="center"> ... </div> to centre it. */
#jsn-page .md-page .center,
#jsn-page .md-page .center p,
#jsn-page .md-page .center h2,
#jsn-page .md-page .center h3 {
  text-align: center;
}
/* Embedded maps, calendars, forms and videos. */
#jsn-page .md-page iframe {
  display: block;
  margin: 0 auto 10px;
  max-width: 100%;
}

/* Photo albums: <div class="gallery"> ... </div> shows pictures as a grid of
   thumbnails; clicking one opens it large (src/scripts/gallery.js). */
#jsn-page .md-page .gallery p {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 20px;
}
#jsn-page .md-page .gallery a,
#jsn-page .md-page .gallery p > img {
  display: block;
  width: 150px;
  height: 112px;
  margin: 0;
}
#jsn-page .md-page .gallery img {
  display: block;
  width: 100%;
  max-width: 150px;
  height: 112px;
  margin: 0;
  object-fit: cover;
  border: 1px solid #ccc;
  cursor: zoom-in;
}
#jsn-page .md-page .gallery a:hover img,
#jsn-page .md-page .gallery a:focus img {
  border-color: #6f8f1a;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
}
.lightbox[hidden] {
  display: none;
}
.lightbox figure {
  margin: 0;
  max-width: calc(100vw - 120px);
  text-align: center;
}
.lightbox img {
  box-sizing: border-box;
  max-width: 100%;
  max-height: calc(100vh - 80px);
  border: 4px solid #fff;
}
.lightbox figcaption {
  color: #eee;
  font-size: 14px;
  margin-top: 6px;
}
.lightbox button {
  position: absolute;
  background: none;
  border: 0;
  color: #fff;
  font-size: 48px;
  line-height: 1;
  padding: 8px 14px;
  cursor: pointer;
}
.lightbox .lb-close { top: 8px; right: 8px; }
.lightbox .lb-prev { left: 4px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 4px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
  #jsn-page .md-page .gallery a,
  #jsn-page .md-page .gallery img { width: 100px; height: 75px; }
  .lightbox figure { max-width: calc(100vw - 16px); }
  .lightbox .lb-prev, .lightbox .lb-next { top: auto; bottom: 8px; transform: none; }
}

/* ---- Home page texts (src/content/home, editable in /admin) ----
   Same look as the old hand-set sizes: boxes in "small" justified text,
   the announcement in "medium" (16px). */
#jsn-page .home-text p,
#jsn-page .home-text li {
  font-size: small;
  text-align: justify;
}
#jsn-page .home-notice p {
  font-size: medium;
}
