:root{
   --Margin_TopBottom: 60px;

   --navColor_0: #fbfbfb;
   --navColor_1: #393939;
   --navColor_2: #fbfbfb;
   --navColor_3: #393939;
}

.compact{
   --Margin_TopBottom: 30px;
}

img, picture {
  height: 100%;
  width: 100%;
  box-sizing: border-box;
  object-fit: cover;
  display: block;
}

/* body
{
   position: fixed;
} */

main
{
  --Gap: var(--margin_Medium);
  --Height: min(max(calc(var(--ClientHeight_Initial) - var(--headerBottom) - 2em), 400px), 600px);
  --Width: min(calc(var(--ClientWidth) - 2em), max(var(--Height) * 2, 600px));
  display: grid;
  width: var(--ClientWidth);
}

.hideProject
{
  display: none !important;
  opacity: 0 !important;
  transform: scale(0) !important;
  scale: 0 !important;
}

#greeting
{
  display: none;
  width: min(calc(100vw - 2em), 35ch);
  margin: var(--margin_MediumLarge) auto;
}

#greeting_Text
{
  color: var(--dark);
}

#greeting a
{
  display: contents;
}

#greeting_Title{
  font-size: var(--fontSize_H1);
  line-height: 100%;
  text-transform: uppercase;
  font-weight: bold;
  color: var(--theme);
}

.Project_container
{
  display: grid;
  width: 100%;
  height: -webkit-fill-available;
  grid-template-columns: 50% 50%;
  grid-template-rows: var(--Margin_TopBottom) auto var(--Margin_TopBottom);
  overflow: hidden;
}

main > section:not(.cluster)
{
  display: grid;
  justify-self: center;
  overflow: hidden;
  height: var(--Height);
  width: var(--Width);
  border-radius: var(--radius);
  margin-bottom: var(--Gap);
}

main > section:first-of-type
{
  margin-top: 1em;
}

main > section:not(.cluster) > div
{
   grid-row: 1;
   grid-column: 1;
}

.cluster .ViewMore
{
  width: 100%;
  background: var(--accent);
  flex: 1;
  border-radius: var(--radius);
}

.cluster .ViewMore.hidden
{
  display: none;
}

.ViewMore a
{
  height: fit-content;
  margin: auto;
}

.Thumbnail
{
  min-height: 100%;
  grid-row: 1 / span 3;
  grid-column: 1 / span 2;
  z-index: -1;
}

.Overview
{
   grid-column: 1;
   grid-row: 1 / span 3;
   margin: auto;
   display: grid;
   grid-template-rows: min-content auto min-content;
   height: 240px;
   max-height: 90%;
   z-index: 1;
}

.Overview > *
{
  grid-column: 1;
}

.Overview > div
{
  display: grid;
  height: min-content;
  margin: auto;
}

.Overview img
{
   height: 80px;
   object-fit: contain;
}

.Overview :not(a) p::before
{
   content: '';
   position: relative;
   display: block;
   width: 160px;
   height: 2px;
   top: -8px;
   background: var(--theme);
   margin: auto;
   margin-top: 5px;
   margin-bottom: 5px;
   border-radius: 1px;
}

.Overview p
{
   color: var(--theme);
   margin-left: auto;
   margin-right: auto;
   width: fit-content;
   font-size: 12pt;
}

.Overview a
{
  margin: auto;
  z-index: 1;
  grid-row: 3;
}


/*
 *
 * Clustering
 *
 */

.cluster
{
  display: flex;
  flex-wrap: wrap;
  gap: var(--Gap);
  --col: 2;
  --ClusterSize: calc((var(--Width) - (var(--Gap) * (var(--col) - 1))) / var(--col));
  --ClusterWidth: var(--ClusterSize);
  --ClusterHeight: var(--ClusterSize);
  width: var(--Width);
  justify-self: center;
  border-radius: var(--radius);
  margin-bottom: var(--Gap);
}

@media (min-width: 800px){
  .cluster{--col: 3;}
}

.cluster > .wide
{
  --ClusterWidth: calc((var(--ClusterSize) * 2) + var(--Gap));
}

.cluster > section
{
  display: grid;
  width: var(--ClusterWidth);
  height: var(--ClusterHeight);
  will-change: auto;
}

@media (hover: hover) and (pointer: fine) {
  .cluster > section::before
  {
    cursor: pointer;
    content: var(--name);
    font-weight: bolder;
    width: var(--ClusterWidth);
    height: var(--ClusterHeight);
    grid-column: 1;
    grid-row: 1;
    z-index: 1;
    text-align: center;
    line-height: var(--ClusterHeight);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--light);
    opacity: 0;
    border-radius: var(--radius);
    transition: opacity var(--animationFast) var(--animationStyle);
    -webkit-transition: opacity var(--animationFast) var(--animationStyle);
    -moz-transition: opacity var(--animationFast) var(--animationStyle);
    -o-transition: opacity var(--animationFast) var(--animationStyle);
    -ms-transition: opacity var(--animationFast) var(--animationStyle);
  }

  .cluster > section:hover::before
  {
    opacity: 1;
  }
}

.cluster > section > div
{
  --CollageSize: clamp(7em, calc(var(--Width) * 0.15), 9em);
  --ColWidth: calc(((var(--Width) - var(--CollageSize)) / 2));
  display: grid;
  background: var(--light);
  width: var(--ClusterWidth);
  height: var(--ClusterHeight);
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  border-radius: var(--radius);
  grid-template-columns: var(--ColWidth) var(--CollageSize) var(--ColWidth);
  grid-template-areas:
    "b t t";

  will-change: contents;

  transition: all var(--animationFast) var(--animationStyle);
  -webkit-transition: all var(--animationFast) var(--animationStyle);
  -moz-transition: all var(--animationFast) var(--animationStyle);
  -o-transition: all var(--animationFast) var(--animationStyle);
  -ms-transition: all var(--animationFast) var(--animationStyle);
}

.cluster > section > div:has(.media)
{
  grid-template-areas:
    "b c t";
}

.cluster .thumbnail
{
  display: grid;
  grid-template-columns: 100%;
  grid-template-rows: 100%;
  grid-area: b;
  width: var(--ClusterWidth);
  height: var(--ClusterHeight);
  border-radius: var(--radius);
  will-change: auto;

  transition: all var(--animationFast) var(--animationStyle);
  -webkit-transition: all var(--animationFast) var(--animationStyle);
  -moz-transition: all var(--animationFast) var(--animationStyle);
  -o-transition: all var(--animationFast) var(--animationStyle);
  -ms-transition: all var(--animationFast) var(--animationStyle);
}

.cluster .thumbnail > *
{
  grid-column: 1;
  grid-row: 1;
}

.cluster .thumbnail .tTransition
{
  opacity: 0;
  z-index: 2;
}

.cluster .thumbnail .tVid
{
  opacity: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.cluster .thumbnail .tImageText
{
  margin: 0.5em;
  margin-top: auto;
  width: fit-content;
  max-width: calc(100% - 1em);
  backdrop-filter: var(--blurHeavy);
  -webkit-backdrop-filter: var(--blurHeavy);
  border-radius: calc(var(--radius) - 0.5em);
  z-index: 3;
  opacity: 0;
  will-change: transform;
  transition: all var(--animationFast) var(--animationStyle);
  -webkit-transition: all var(--animationFast) var(--animationStyle);
  -moz-transition: all var(--animationFast) var(--animationStyle);
  -o-transition: all var(--animationFast) var(--animationStyle);
  -ms-transition: all var(--animationFast) var(--animationStyle);
}

.cluster .thumbnail .tImageText > *
{
  font-size: 11pt;
  color: white;
  padding: 0.25em 0.5em;
  margin: unset;
  width: auto;
}

.cluster .on .thumbnail .tImageText
{
  opacity: 1;
}

.cluster .playvid .tImageText
{
  margin-top: 0.5em;
  margin-bottom: auto;
}

.cluster .playvid .tImg
{
  opacity: 0;
  pointer-events: none;
}

.cluster .playvid .tVid
{
  opacity: 1;
  z-index: 1;
}


@keyframes fadeOut {
  0%
  {
    opacity: 1;
  }
  100%
  {
    opacity: 0;
  }
}

.cluster .media
{
  height: calc(var(--Height) - 2em);
  grid-area: c;
  overflow: scroll;
  display: flex;
  gap: 1em;
  flex-direction: column;
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
  padding: 1em;
}
.cluster .media::-webkit-scrollbar {
  display: none;
}

.cluster .on .media,
.cluster .on span:not(.tImageText)
{
  transform: translateX(0px) translateY(0px) !important;
  opacity: 1;
}

.cluster .media,
.cluster span:not(.tImageText)
{
  transform: translateX(calc( 0px - (var(--ColWidth) - var(--ClusterWidth)) ));
  will-change: transform;
  opacity: 0;

  transition: all var(--animationFast) var(--animationStyle);
  -webkit-transition: all var(--animationFast) var(--animationStyle);
  -moz-transition: all var(--animationFast) var(--animationStyle);
  -o-transition: all var(--animationFast) var(--animationStyle);
  -ms-transition: all var(--animationFast) var(--animationStyle);
}

.cluster .media > div
{
  height: 33%;
  display: grid;
  cursor: pointer;
  
  border-radius: var(--radius);
  
  transition: transform var(--animationFast) var(--animationStyle), box-shadow var(--animationFast) var(--animationStyle);
  -webkit-transition: transform var(--animationFast) var(--animationStyle), box-shadow var(--animationFast) var(--animationStyle);
  -moz-transition: transform var(--animationFast) var(--animationStyle), box-shadow var(--animationFast) var(--animationStyle);
  -o-transition: transform var(--animationFast) var(--animationStyle), box-shadow var(--animationFast) var(--animationStyle);
  -ms-transition: transform var(--animationFast) var(--animationStyle), box-shadow var(--animationFast) var(--animationStyle);
}

.cluster .media > div:hover
{
  z-index: 2;
  transform: scale(1.1);
  box-shadow: var(--shadowClose);
}

.cluster .media > div:has([video]) img
{
  filter: brightness(0.75);
}

.cluster .media > div:has([video])::before
{
  content: url(../Resources/Vector/Play.svg);
  display: block;
  pointer-events: none;
  grid-column: 1;
  grid-row: 1;

  width: 25%;
  justify-self: center;
  align-self: center;

  /* For centering */
  margin-bottom: -7px;
  transform-origin: 38% calc(50% - 3px);
  transform: translateX(6%);

  z-index: 2;
  border-radius: var(--radius);
}

.cluster .media img
{
  width: 100%;
  box-sizing: border-box;
  object-fit: cover;
  display: block;
  aspect-ratio: 1;
  border-radius: var(--radius);
  grid-column: 1;
  grid-row: 1;
}

.cluster .on .media img
{
  pointer-events: all;
}

/* 
.cluster .media img:first-of-type
{
  margin-top: 1em;
} */

.cluster span:not(.tImageText)
{
  width: -webkit-fill-available;
  max-width: max(100%, 40ch);
  grid-area: t;
  padding-right: var(--margin_Medium);
  padding-left: calc(var(--margin_Medium) - 1em);
  justify-self: center;
  overflow-y: scroll;
  height: var(--Height);
}

.cluster span > *:last-child
{
  padding-bottom: var(--margin_Medium);
}

.cluster span h1,
.cluster span h1::before
{
  content: var(--name);
  margin-top: var(--margin_Medium);
  text-align: left;
}

.cluster span p:not(:nth-child(2)),
.cluster span h4:not(:nth-child(2))
{
  margin-top: 0px;
}

.cluster .CloseButton
{
  width: 1.25em;
  height: 1.25em;
  position: absolute;
  right: 1em;
  top: 1em;
  padding: 0.5em;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--dark);
  z-index: 2;
  opacity: 0;
  pointer-events: none;

  box-shadow: var(--shadowClose);

  transition: all var(--animationFast) var(--animationStyle);
  -webkit-transition: all var(--animationFast) var(--animationStyle);
  -moz-transition: all var(--animationFast) var(--animationStyle);
  -o-transition: all var(--animationFast) var(--animationStyle);
  -ms-transition: all var(--animationFast) var(--animationStyle);
}

.cluster .on .CloseButton
{
  opacity: 1;
  pointer-events: all;
}

@media (hover: hover) and (pointer: fine) {
  .cluster .on .CloseButton:hover
  {
    transform: scale(1.1);
  }
}

.cluster .CloseButton svg
{
  display: block;
  fill: none;
  stroke-width: 0.08em;
  stroke: var(--light);
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
  transform: translateX(2%) translateY(2%) rotate(45deg);
}

main .Backdrop
{
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgb(0 0 0 / 0%);
  z-index: 5;
  pointer-events: none;

  transition: all var(--animationFast) var(--animationStyle);
  -webkit-transition: all var(--animationFast) var(--animationStyle);
  -moz-transition: all var(--animationFast) var(--animationStyle);
  -o-transition: all var(--animationFast) var(--animationStyle);
  -ms-transition: all var(--animationFast) var(--animationStyle);

}

main:has(.cluster > .on) .Backdrop
{
  pointer-events: all;
  background: rgb(0 0 0 / 75%);
}

.cluster > section.on
{
  z-index: 15;
}

.cluster > section.on::before
{
  opacity: 1;
  background: var(--medium);
  z-index: -10;
  filter: brightness(0.5);
}

.cluster section.on .thumbnail
{
  width: min(var(--Width), 100%);
  height: min(var(--Height), 100%);
  border-radius: 0;
  will-change: auto;

  transition: all var(--animationFast) var(--animationStyle);
  -webkit-transition: all var(--animationFast) var(--animationStyle);
  -moz-transition: all var(--animationFast) var(--animationStyle);
  -o-transition: all var(--animationFast) var(--animationStyle);
  -ms-transition: all var(--animationFast) var(--animationStyle);
}

@keyframes expand {
  0%
  {
    top: var(--Y);
    left: var(--X);
    position: fixed;
  }
  100%
  {
    width: var(--Width);
    height: var(--Height);
    z-index: 10;
    box-shadow: var(--shadowClose);
    top: calc(max(var(--headerBottom) + 1em, (((var(--ClientHeight) + var(--headerBottom)) - var(--Height)) / 2)));
    left: calc((var(--ClientWidth) - var(--Width)) / 2);
    position: fixed;
  }
}


@keyframes retract {
  0%
  {
    width: var(--Width);
    height: var(--Height);
    z-index: 10;
    box-shadow: var(--shadowClose);
    top: calc(max(var(--headerBottom) + 1em, (((var(--ClientHeight) + var(--headerBottom)) - var(--Height)) / 2)));
    left: calc((var(--ClientWidth) - var(--Width)) / 2);
    position: fixed;
  }
  100%
  {
    position: fixed;
    z-index: 15;
    top: var(--Y);
    left: var(--X);
    position: fixed;
  }
}

@media (max-width: 900px){
  .cluster > section > div
  {
    grid-template-columns: calc(var(--Width) / 2) auto;
    grid-template-rows: calc(var(--Height) - var(--CollageSize)) var(--CollageSize);
    grid-template-areas:
      "b t"
      "b t";
  }

  .cluster > section > div:has(.media)
  {
    grid-template-areas:
      "b t"
      "c t";
  }

  .cluster span:not(.tImageText)
  {
    padding: 0 var(--margin_Medium);
  }

  .cluster .media
  {
    margin-bottom: 0;
    flex-direction: row;
    height: calc(var(--CollageSize) - 2em);
  }

  .cluster .media img
  {
    height: 100%;
  }

  .cluster .media
  {
    transform: translateX(0px) translateY(calc(var(--ClusterHeight) - (var(--Height) - var(--CollageSize))));
  }

  .cluster span:not(.tImageText)
  {
    transform: translateX(calc( 0px - (var(--ColWidth) - var(--ClusterWidth)) ));
  }
}


@media screen and (orientation:portrait)
{
  main
  {
    --Gap: 1em;
  }

  main > section:first-of-type
  {
    margin-top: var(--headerBottom);
  }

  .Overview
  {
    grid-column: 1 / span 2;
    height: 100%;
    max-height: unset;
    grid-template-rows: 1fr 1fr 1fr;
  }

  .Overview img
  {
    height: 64px;
  }

  .Project_container
  {
    grid-template-rows: 1fr 1fr 1fr;
  }

  .cluster > section > div
  {
    grid-template-columns: unset;
    grid-template-rows: min(var(--Width), 50vh) var(--CollageSize) min-content;
    grid-template-areas:
      "b"
      "t"
      "t";
  }

  .cluster > section > div:has(.media)
  {
    grid-template-areas:
      "b"
      "c"
      "t";
  }

  .cluster > section.on > div
  {
    overflow: scroll;
  }

  .cluster section.on .thumbnail
  {
    width: var(--Width);
  }

  .cluster span:not(.tImageText)
  {
    padding: 0 1em;
    overflow: hidden;
    height: fit-content;
  }

  .cluster span h1
  {
    margin-top: var(--margin_Small);
  }

  .cluster .CloseButton
  {
    position: sticky;
    grid-area: b;
    margin-left: auto;
  }

  .cluster .media,
  .cluster span:not(.tImageText)
  {
    transform: translateX(0px) translateY(0px) !important;
  }
}
