/* GLOBAL */

:root {

  /* sizing*/
  --gap: 4px;
  --margin-xl: 200px;
  --margin-l: 100px;
  --margin-m: 50px;
  --margin-s: 25px;
  --video-height: 500px;

  /* typography*/
  --font-size: 28px;
  --line-height: 36px;
  --font-size-small: 16px;
  --line-height-small: var(--font-size);

  /* colors */
  --textColor: #161616;
  --textColor-negative: white;
  --backgroundColor: rgb(240, 240, 240);
}

@font-face {
  font-family: "WhyteSemiMono-Regular";
  src: url("../assets/fonts/ABCWhyteSemiMono-Regular.woff2") format("woff");
}

html {
  scroll-behavior: smooth;
  background-color: var(--backgroundColor);
  -webkit-text-size-adjust: 100%;
}


.difference-fix {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  background-color: var(--backgroundColor);
}

body {
  margin: 0;
  font-family: WhyteSemiMono-Regular;
  font-size: var(--font-size);
  line-height: var(--line-height);
  background-color: var(--backgroundColor);
  color: var(--textColor);
  text-decoration: none;
  overflow-x: hidden;
}

@media screen and (min-width: 768px) {
  body.showreel-body {
    overflow: hidden;
  }
}

p {
  margin-block-start: 0px;
  margin-block-end: 0px;
}

a {
  text-decoration: underline;
  text-underline-offset: var(--gap);
  text-decoration-thickness: calc(var(--gap) * 0.625);
  color: var(--textColor);
}

a[target="_blank"],
a.inline-markdown-link {
  white-space: nowrap;
}

a[target="_blank"]::after,
a.inline-markdown-link::after {
  content: "↗";
  display: inline-block;
  white-space: preserve;
  text-decoration: none;
  vertical-align: top;
  font-size: calc(var(--font-size) * 0.8);
  margin-left: calc(var(--font-size) * 0.15);
}


/* NAVIGATION */

.navigation {
  display: block;
  position: fixed;
  z-index: 99;
  top: var(--margin-m);
  color: var(--textColor-negative);
  mix-blend-mode: difference;

  text-decoration: none;
}

#navigation-topLeft {
  left: var(--margin-m);
}

#navigation-topRight {
  right: var(--margin-m);
  text-align: right;
}

#navigation-bottomLeft {
  left: var(--margin-m);
  bottom: var(--margin-m);
  top: auto;
}

#navigation-bottomRight {
  right: var(--margin-m);
  text-align: right;
  bottom: var(--margin-m);
  top: auto;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 2.5px;
}


/* CONTENT */

.content {
  display: block;
  width: min(960px, calc(100% - (var(--margin-l) * 2.25)));
  height: auto;
  margin: 0 auto;
  padding-top: var(--margin-xl);
  margin-bottom: var(--margin-l);
  box-sizing: border-box;
}

.content#intro {
  position: fixed;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  padding: 0;
  margin: 0;
  z-index: 100;
  color: var(--textColor-negative);
  max-height: calc(100dvh - (var(--margin-l) * 2));
  overflow-y: auto;
  /* -webkit-text-stroke-width: 0.1px;
  -webkit-text-stroke-color: var(--textColor); */
  mix-blend-mode: difference;
}

.content#intro a {
  color: var(--textColor-negative);
}

.project-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin-top: var(--gap);
}

.project-gallery .gallery-element {
  position: relative;
  margin: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  min-width: 0;
  height: auto;
}

/* Querformat: 1 pro Zeile */
.project-gallery .gallery-element-wide {
  flex: 0 0 100%;
  width: 100%;
}

/* Hochformat/Quadrat: 2 pro Zeile */
.project-gallery .gallery-element-half {
  flex: 0 0 calc(50% - var(--gap) * 0.5);
  width: calc(50% - var(--gap) * 0.5);
}

.project-gallery img,
.project-gallery video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.gallery .video-poster-fallback,
.project-gallery .video-poster-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.gallery video,
.project-gallery video,
.gallery .video-safari-fallback,
.project-gallery .video-safari-fallback {
  z-index: 1;
}

.project-gallery video,
.project-gallery .video-safari-fallback {
  position: relative;
}

/* TEXTBOX */

.textbox {
  margin: 0 var(--margin-l);
}

.textbox+video+img,
.textbox+video {
  margin-top: var(--margin-l);
}

.textbox+.project-gallery {
  margin-top: var(--margin-l);
}


/* GALLERY */

.gallery {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: var(--gap);
  /* margin: var(--margin-l);
  margin-top: 0; */
}

.gallery-element {
  flex: 0 0 calc(50% - var(--gap) * 0.5);
  height: var(--video-height);
  margin-block-start: var(--gap);
  position: relative;
  overflow: hidden;
}

.gallery-element.is-video-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 10;
  width: var(--margin-m);
  height: var(--margin-m);
  box-sizing: border-box;
  border: var(--gap) solid var(--textColor);
  border-top-color: var(--backgroundColor);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: video-loading-spin 1s linear infinite;
}

.gallery-element.is-video-loading {
  isolation: isolate;
}

@keyframes video-loading-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-element.is-video-loading::before {
    animation: none;
  }
}

#project-gallery .gallery-element:last-child:nth-child(odd) {
  margin-left: auto;
  margin-right: auto;
}

.gallery-element a {
  background-color: black;
  display: block;
  position: absolute;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.gallery video,
.gallery img {
  display: block;
  position: absolute;
  object-fit: cover;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#project-gallery .gallery-element a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.22);
  opacity: 0;
  transition: opacity 0.1s ease;
}

.gallery-element-textbox {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.1s ease;
  /* mix-blend-mode: difference; */
}

.gallery-element-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.1s ease;
  color: var(--textColor-negative);
  padding: var(--margin-m);
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 0;
  /* mix-blend-mode: difference; */
}

.gallery-element-tag-bubble {
  background: transparent;
  color: var(--textColor-negative);
  font-family: WhyteSemiMono-Regular;
  font-size: var(--font-size-small);
  line-height: var(--line-height-small);
  padding: calc(var(--font-size-small) * 0.15) calc(var(--font-size-small) * 1);
  border-radius: 50px;
  display: inline-block;
  border: 1px solid var(--textColor-negative);
  margin-bottom: -1px;
}

.gallery p {
  color: var(--textColor-negative);
  padding: var(--margin-m);
}

#project-gallery .gallery-element:hover .gallery-element-textbox,
#project-gallery .gallery-element:hover .gallery-element-tag {
  opacity: 1;
}

#project-gallery .gallery-element.on-scroll-focus .gallery-element-textbox {
  opacity: 1;
}

#project-gallery .gallery-element:hover a::after,
#project-gallery .gallery-element.on-scroll-focus a::after {
  opacity: 1;
}

#project-gallery .gallery-element.on-scroll-focus .gallery-element-textbox {
  opacity: 1;
}


/* TAG FILTER */

.tag-filter {
  width: 67.5%;
  margin: 0 auto;
  margin-top: calc(var(--margin-xl) - ((var(--font-size-small) + var(--line-height-small)) * 1.5));
  margin-bottom: calc((var(--font-size-small) + var(--line-height-small)) * 0.5);
  position: sticky;
  top: var(--margin-m);
  z-index: 98;
  display: flex;
  flex-wrap: wrap;
  gap: 0px;
  justify-content: center;
}

.tag-button {
  background: var(--textColor-negative);
  border: none;
  color: var(--textColor);
  font-family: WhyteSemiMono-Regular;
  font-size: var(--font-size-small);
  line-height: var(--line-height-small);
  cursor: pointer;
  padding: calc(var(--font-size-small) * 0.5) calc(var(--font-size-small) * 1.25);
  text-decoration: none;
  transition: all 0.15s ease;
  border-radius: 50px;
}

.tag-button:hover {
  padding: calc(var(--font-size-small) * 0.5) calc(var(--font-size-small) * 4);
}

/* used by JS to measure the hover width without triggering a real :hover */
.tag-button.tag-button-measure-hover {
  padding: calc(var(--font-size-small) * 0.5) calc(var(--font-size-small) * 4);
}

.tag-filter-break {
  flex-basis: 100%;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
}

.tag-button.active {
  background: var(--textColor);
  color: var(--textColor-negative);
}


/* PROJECT TAGS */

.project-tags-container {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0px;
  margin-top: calc(var(--line-height) * 0.7);
  margin-left: calc(var(--font-size-small) * -0.1);
  margin-bottom: calc(var(--line-height) * 0.2);
}

.project-tag-bubble {
  background: transparent;
  color: var(--textColor);
  font-family: WhyteSemiMono-Regular;
  font-size: var(--font-size-small);
  line-height: var(--line-height-small);
  white-space: nowrap;
  word-break: keep-all;
  padding: calc(var(--font-size-small) * 0.2) calc(var(--font-size-small) * 1);
  border-radius: 50px;
  border: 1px solid var(--textColor);
  display: inline-block;
  margin-bottom: 0px;
}

/* ADDITIONAL INFO LABELS */

.additional-info-table {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: 100%;
  column-gap: calc(var(--margin-l) * 0.15);
}

.additional-info-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.additional-info-item {
  display: block;
  min-width: 0;
  padding-bottom: calc(var(--line-height) * 1);
}

.additional-info-item:last-child {
  padding-bottom: 0;
}

.additional-info-label {
  display: inline-block;
  font-size: var(--font-size-small);
  line-height: var(--line-height-small);
  text-transform: uppercase;
}

.additional-info-value {
  display: inline-block;
  font-size: var(--font-size);
  line-height: var(--line-height);
  white-space: pre-line;
}

.textbox .functionality-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0;
}

.project-description {
  --project-description-collapsed-height: calc(var(--line-height) * 17);
  --project-description-expanded-height: none;
  margin: 0;
  position: relative;
  max-height: var(--project-description-expanded-height);
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.project-description-collapsed {
  max-height: var(--project-description-collapsed-height);
}

.project-description-collapsed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: calc(var(--line-height) * 4);
  pointer-events: none;
  background: linear-gradient(to bottom,
      rgba(240, 240, 240, 0),
      var(--backgroundColor));
}

.project-description-toggle {
  display: inline-block;
  margin: var(--line-height) 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--textColor);
  font-family: WhyteSemiMono-Regular;
  font-size: var(--font-size);
  line-height: var(--line-height);
  text-decoration: none;
  cursor: pointer;
}

.project-description-toggle[hidden] {
  display: none;
}

.project-links {
  margin-top: var(--line-height);
}


/* TABLET DEVICES */

@media screen and (max-width: 1079px) {

  :root {

    /* sizing*/
    --gap: 3px;
    --margin-xl: 160px;
    --margin-l: 80px;
    --margin-m: 40px;
    --margin-s: 20px;
    --video-height: 500px;

    /* typography*/
    --font-size: 26px;
    --line-height: 32px;
    --font-size-small: 16px;
    --line-height-small: var(--font-size);
  }

  .content {
    width: calc(100% - (var(--margin-m) * 2));
  }

  .textbox {
    margin: 0;
  }

  .tag-filter {

    margin-top: calc(var(--margin-l) * 1.25);
    margin-bottom: var(--margin-m);
    top: calc(var(--margin-l) * 1.25);
    justify-content: center;
  }

  .tag-button {
    padding: calc(var(--font-size-small) * 0.5) calc(var(--font-size-small) * 1.25);
  }

  .tag-button:hover,
  .tag-button.tag-button-measure-hover {
    padding: calc(var(--font-size-small) * 0.5) calc(var(--font-size-small) * 1.25);
  }

  .gallery {
    margin: var(--gap);
    margin-top: var(--margin-s);
  }

  .project-gallery {
    width: calc(100vw - (var(--gap) * 2));
    margin-right: 0;
    margin-left: calc(var(--gap) - var(--margin-m));
  }

}

/* MOBILE DEVICES */
@media screen and (max-width: 767px) {

  :root {

    /* sizing*/
    --gap: 2px;
    --margin-xl: 106px;
    --margin-l: 72px;
    --margin-m: 36px;
    --margin-s: 18px;
    --video-height: 100vw;

    /* typography*/
    --font-size: 20px;
    --line-height: 24px;
    --font-size-small: 12px;
    --line-height-small: var(--line-height);
  }

  a[target="_blank"],
  a.inline-markdown-link {
    white-space: normal;
  }

  .navigation {
    top: var(--margin-s);
    white-space: nowrap;
  }

  #navigation-topLeft {
    left: var(--margin-s);
  }

  #navigation-topRight {
    right: var(--margin-s);
  }

  #navigation-bottomLeft {
    left: var(--margin-s);
    bottom: var(--margin-s);
  }

  #navigation-bottomRight {
    right: var(--margin-s);
    bottom: var(--margin-s);
  }

  .content {
    width: calc(100% - (var(--margin-s) * 2));
    padding-top: var(--margin-xl);
    margin-bottom: var(--margin-s);
  }

  .showreel-viewport {
    display: none;
  }

  .content#intro {
    position: static;
    width: calc(100% - (var(--margin-s) * 2));
    max-height: none;
    overflow: visible;
    translate: none;
    padding-top: var(--margin-xl);
    margin: 0 auto var(--margin-l);
    margin-bottom: var(--margin-xl);
    color: var(--textColor);
    mix-blend-mode: normal;
    z-index: 100;
  }

  .content#intro a {
    color: var(--textColor);
  }

  .textbox {
    margin: 0;
  }

  .textbox+video+img,
  .textbox+video,
  .textbox+.project-gallery {
    margin-top: var(--margin-m);
  }

  .gallery {
    margin: var(--gap);
    margin-top: var(--margin-s);
  }

  .gallery-element {
    flex-basis: 100%;
    height: var(--video-height);
  }

  .gallery p {
    padding: var(--margin-s);
  }

  .gallery-element-tag {
    padding: var(--margin-s);
  }

  .tag-filter {
    width: calc(100% - (var(--margin-s) * 2));
    margin-top: var(--margin-l);
    margin-bottom: var(--margin-s);
    top: var(--margin-l);
    justify-content: center;
  }

  .tag-button {
    min-height: 32px;
    padding: calc(var(--font-size-small) * 0.45) calc(var(--font-size-small) * 1.05);
  }

  .tag-button:hover,
  .tag-button.tag-button-measure-hover {
    padding: calc(var(--font-size-small) * 0.45) calc(var(--font-size-small) * 1.05);
  }

  .project-tags-container {
    flex-wrap: wrap;
    align-items: flex-start;
    margin-left: 0;
    margin-bottom: calc(var(--line-height) * 0.2 + 1px);
  }

  .project-tag-bubble {
    margin-right: -1px;
    margin-bottom: -1px;
  }

  .additional-info-table {
    display: block;
  }

  .additional-info-column+.additional-info-column {
    margin-top: var(--line-height);
  }

  .project-description {
    --project-description-collapsed-height: calc(var(--line-height) * 14);
  }

  .project-gallery {
    display: flex;
    gap: var(--gap);
    width: calc(100vw - (var(--gap) * 2));
    margin-top: var(--margin-m);
    margin-right: 0;
    margin-left: calc(var(--gap) - var(--margin-s));
  }

  .project-gallery .gallery-element,
  .project-gallery .gallery-element-wide,
  .project-gallery .gallery-element-half {
    width: 100%;
    flex-basis: 100%;
  }

  .project-gallery .gallery-element-mobile-5x4 {
    aspect-ratio: 5 / 4 !important;
  }

}

@media (hover: none) and (pointer: coarse) {

  .tag-button:hover,
  .tag-button.tag-button-measure-hover {
    padding: calc(var(--font-size-small) * 0.5) calc(var(--font-size-small) * 1.25);
  }

  #project-gallery .gallery-element .gallery-element-textbox,
  #project-gallery .gallery-element.on-scroll-focus .gallery-element-textbox {
    opacity: 1;
  }

  #project-gallery .gallery-element .gallery-element-tag {
    opacity: 1;
  }

  #project-gallery .gallery-element a::after {
    opacity: 1;
  }
}