/* PAGE GALLERY */

html {
  --lavender-lighter: #e0d7ea;
}

a:focus, a:active {
  outline: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.page-gallery {
  display: flex;
  position: absolute;
  left: 0;
  right: 0;
  top: var(--header-height, 200px);
  bottom: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: white;
}

html.use-transitions .page-gallery {
  transition: bottom 0.5s, top 0.5s;
}

.visible-when-expanded {
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
}

.zero-height-when-collapsed {
  overflow: hidden;
  height: 0;
}

html.use-transitions .visible-when-expanded {
  transition: opacity 0.5s 0.5s, width 0.5s;
}

html.use-transitions .visible-when-expanded.hidden-when-collapsed {
  transition: opacity 0.25s 0s;
}

.page {
  background-color: #ffffff;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: calc(100vw / 8);
  height: calc(100vh - var(--header-height));
  height: calc(var(--vh, 1vh) * 100 - var(--header-height));
  outline: 1px solid rgba(0,0,0,0.2);
}

/* @TODO needs refactor */
.page p + p {
  margin-top: 1em;
}

.page.page--full-bleed {
  padding: 0;
}

.page-gallery-link {
  position: relative; /* this is required for the fade overlay */
  text-decoration: none;
  color: black;
}

.click-scroll {
  position: absolute;
  left: calc(50% - 80px);
  bottom: 1rem;
  color: white;
}

.click-scroll svg {
  opacity: 0.1;
}

html.use-transitions .click-scroll svg {
  will-change: opacity;
  transition: opacity 0.5s;
}

.click-scroll:hover svg {
  opacity: 0.1;
  animation: pulse-01-to-03 2s ease-out infinite;
  cursor: pointer;
}

.click-scroll.clicked svg {
  opacity: 0;
  cursor: pointer;
}

.collapsed-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* because tablets and non-desktop devices report 100vh including the
     browser ui elements (address bar, tabs, etc). We need to use a js
     calculated var, which is more accurate. So first we set our fallback
     and then we attempt to use the --vh js-calculated value. */
  height: calc(100vh - var(--header-height));
  height: calc(var(--vh, 1vh) * 100 - var(--header-height));
  max-height: 100%;
  user-select: none;
  will-change: background-color, height;
}

.collapsed-content:focus {
  border: 2px dotted rebeccapurple;
}

html.use-transitions .collapsed-content {
  --color-delay: 0.5s;
  transition: background-color 0.5s var(--color-delay);
}

.collapsed-content .short-description {
  text-align: center;
  min-height: 10rem;
  max-width: 200px;
  font-size: 0.8rem;
}

.collapsed-content h3 {
  margin: 0;
  padding: 0;
}

@media only screen and (max-width: 930px) {
  .collapsed-content h3 {
    color: transparent;
    font-size: 0;
  }
  .collapsed-content h3::after {
    color: rgba(0, 0, 0, 0.2);
    display: block;
    font-size: 3rem;
    content: attr(data-char);
  }
  .collapsed-content:hover h3::after {
    color: rgba(0, 0, 0, 0.8);
  }

  html.use-transitions .collapsed-content h3::after {
    transition: color 0.5s;
  }

  :target ~ .page-gallery .collapsed-content h3 {
    color: black;
    font-size: initial;
  }

  :target ~ .page-gallery .collapsed-content h3::after {
    display: none;
  }
}

:root.use-transitions .page {
  transition: transform 0.5s, left 0.5s, width 0.5s;
}

/* has:(:target) changes */

:target ~ .page-gallery-exit {
  visibility: visible;
  opacity: 1;
}

:target ~ .page-gallery-exit:hover {
  animation: pulse-1-to-05 2s ease-out infinite;
}

:target ~ .fullscreen:hover {
  animation: pulse-1-to-05 2s ease-out infinite;
  color: white;
}

/* expanded content */

.expanded-content {
  position: relative;
  display: none; /* optimisation: by default this content is hidden until targeted */
  padding: 6em;
  min-height: calc(100vh - var(--header-height));
  min-height: calc(var(--vh, 1vh) * 100 - var(--header-height));
}

.target--intro .expanded-content {
  margin: 0;
  padding: 0;
}

@media only screen and (max-width: 1000px) {
  .page-gallery-link {
    display: inline-block;
    overflow: hidden;
  }

  .expanded-content {
    position: relative;
    padding: 3em;
  }
}

/* specific modifications to the galleryNavRules */
#intro:target ~ .page-gallery .target--intro .collapsed-content {
  background-color: var(--sunset-base);
}

#intro:target ~ .page-gallery .target--intro {
  border: 0 !important;
}

#about:target ~ .page-gallery .target--about .collapsed-content {
  background-color: var(--slate-base);
}

#projects:target ~ .page-gallery .target--projects .collapsed-content,
#projects__spiraldust:target ~ .page-gallery .target--projects .collapsed-content,
#projects__alwtm:target ~ .page-gallery .target--projects .collapsed-content,
#projects__teowad:target ~ .page-gallery .target--projects .collapsed-content,
#projects__exit:target ~ .page-gallery .target--projects .collapsed-content,
#projects__mote:target ~ .page-gallery .target--projects .collapsed-content {
  background-color: var(--charcoal-base);
}

#history:target ~ .page-gallery .target--history .collapsed-content {
  background-color: var(--vanilla-base);
}

#experiments:target ~ .page-gallery .target--experiments .collapsed-content,
#experiments__harmsway:target ~ .page-gallery .target--experiments .collapsed-content {
  background-color: var(--sage-base);
  --pattern-color: var(--sage-base);
  --pattern-seed: var(--daytime);
  background-image: paint(geometric-pattern);
}

#other:target ~ .page-gallery .target--other .collapsed-content {
  background-color: var(--teal-base);
}

#libraries:target ~ .page-gallery .target--libraries .collapsed-content {
  background-color: var(--coffee-light);
}

#contact:target ~ .page-gallery .target--contact .collapsed-content {
  background-color: var(--lavender-light);
}

#contact:target ~ .page-gallery .target--contact .expanded-content {
  background-color: var(--lavender-lighter);
}