/* ==========================================================
   monosaic: shared stylesheet
   Every page loads this one file.
   ========================================================== */

/* ---- Basics ------------------------------------------------ */
* {
  box-sizing: border-box;
}

html {
  background: #ffffff;
}

body {
  margin: 0;
  background: #ffffff;
  color: #000000;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  /* leave room for the fixed navigation bar */
  padding-top: 5rem;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---- Navigation bar ---------------------------------------- */
/* Fixed to the top of the screen on every page.
   Three columns: links on the left | logo in the middle | (empty) */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  font-size: 1rem;
}

.nav-links {
  justify-self: start;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* the little slashes between links */
.nav-links .sep {
  margin: 0 0.3em;
}

/* ---- The logo ---------------------------------------------- */
/* Same font, size and black as the rest of the page,
   with space between the letters. */
.logo {
  font-size: 1.1rem;
  letter-spacing: 0.35em;
  margin-right: -0.35em; /* cancels the extra space after the last letter, so it stays centred */
}

/* ---- Home page: ASCII mosaic ------------------------------- */
body.home {
  overflow: hidden; /* the mosaic fills the screen, no scrolling */
}

/* On the home page the menu is a vertical list in the dead center of the screen,
   without the slashes. The logo stays at the top. */
body.home .nav-links {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

body.home .nav-links .sep {
  display: none;
}

/* the "---" line under "See" (only shows on the home page) */
.nav-links .divider {
  display: none;
}

body.home .nav-links .divider {
  display: block;
}

body.home .logo {
  grid-column: 2; /* the menu has left the top bar, so keep the logo in the middle column */
}

#mosaic {
  position: fixed;
  inset: 0;
  pointer-events: none; /* clicks pass straight through to the links */
  font-family: "SFMono-Regular", Menlo, Consolas, "Courier New", monospace;
  font-size: 1.1rem;
  line-height: 1.15;
}

#mosaic .group {
  position: absolute;
  white-space: pre;
  opacity: 0.7; /* the "a bit opaque" setting: 1 = solid, 0 = invisible */
}

/* ---- Subpages ---------------------------------------------- */
main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  position: relative;
  z-index: 1; /* keeps the text above the mosaic symbols behind it */
  /* all text on the subpages: 1pt smaller than the normal 1rem.
     (headings below use 1em, which means "same as this") */
  font-size: calc(1rem - 1pt);
}

main h1 {
  font-size: 1em;
  font-weight: 700;
  margin: 0 0 1.5rem;
}

/* Links inside the page content have no underline,
   just like the menu: they only get one when you point at them. */
main a {
  text-decoration: none;
}

main a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Hidden on screen but still read out by screen readers
   (used for page titles the menu already shows). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Listen page (and any page with sections of links) ----- */
main section {
  margin-bottom: 3rem;
}

main h2 {
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 0 0 1rem;
}

ul.links {
  list-style: none; /* no bullet points */
  margin: 0;
  padding: 0;
}

ul.links li {
  margin: 0 0 0.5rem;
}

/* ---- See page: the artworks -------------------------------- */
/* The page is wide, not a narrow text column. js/see.js sets the
   position and size of every work, and the height of #works. */
main.gallery {
  max-width: none;
  margin: 0;
  padding: 1.5rem 1.5rem 5rem;
}

#works {
  position: relative;
  width: 100%;
}

.work {
  position: absolute;
  margin: 0;
  cursor: pointer;
  opacity: 0;                      /* each work fades in once it is in place */
  transition: opacity 0.8s ease;
}

.work.show {
  opacity: 1;
}

.work:focus-visible {
  outline: 1px solid #000000;
  outline-offset: 4px;
}

/* every preview is a square: the picture or video is cropped to fill it */
.work img,
.work video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Pop-out: a work at full size over a blurred page ------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;                    /* above the menu and the mosaic */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);      /* the blur: a bigger number blurs more */
  opacity: 0;
  transition: opacity 0.35s ease;
  cursor: zoom-out;
}

.lightbox-close,
.lightbox-mute {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: #000000;
  font: inherit;
  cursor: pointer;
}

.lightbox-name {
  position: absolute;
  top: 1.25rem;
  left: 1.5rem;
  max-width: calc(100% - 12rem);   /* leaves room for "mute" and "close" */
  color: #888888;                  /* the grey */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.lightbox-mute {
  right: 5.5rem;                   /* sits to the left of "close" */
}

.lightbox-close:hover,
.lightbox-mute:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.lightbox.open {
  opacity: 1;
}

.lightbox img,
.lightbox video {
  width: 92vw;                     /* "most of the screen" */
  height: 88vh;
  height: 88dvh;
  object-fit: contain;             /* the whole work, never cropped or stretched */
  transition: transform 0.35s ease;
}

@media (prefers-reduced-motion: reduce) {
  .work,
  .lightbox,
  .lightbox img,
  .lightbox video {
    transition: none;
  }
}

/* ---- Links page: the link clouds --------------------------- */
/* js/clouds.js sets the position of every cloud and the height of #clouds. */
main.clouds-page {
  max-width: none;
  margin: 0;
  padding: 0;
}

#clouds {
  position: relative;
  width: 100%;
}

.cloud-link {
  position: absolute;
  display: block;
  text-align: center;
  opacity: 0;                      /* each cloud fades in once it is in place */
  transition: opacity 0.8s ease;
}

.cloud-link.show {
  opacity: 1;
}

.cloud-text {
  display: block;
  white-space: nowrap;
  font-weight: 700;                /* the link text is bold */
}

.cloud-body {
  display: block;
  position: relative;
  white-space: pre;
  user-select: none;
  -webkit-user-select: none;
}

.cloud-body span {
  position: absolute;
  text-align: center;
}

/* pointing at a cloud underlines its text */
main a.cloud-link:hover {
  text-decoration: none;
}

.cloud-link:hover .cloud-text {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (prefers-reduced-motion: reduce) {
  .cloud-link {
    transition: none;
  }
}

/* ---- Small screens ----------------------------------------- */
/* The logo and the links each get their own row so nothing gets squeezed. */
@media (max-width: 720px) {
  body {
    padding-top: 6.5rem;
  }

  .nav {
    grid-template-columns: 1fr;
    row-gap: 0.75rem;
    padding: 1rem 1.25rem;
  }

  body.home .logo {
    grid-column: 1;
  }

  .logo {
    grid-row: 1;            /* logo in the middle, first row */
    justify-self: center;
  }

  .nav-links {
    grid-row: 2;            /* links on the left, second row */
    justify-self: start;
  }
}
