  :root {
	--secondary-background-color: #fff3de; /* f7f7f7; */
  --header-background-color: #494848;
  --lightbox-background-color: rgba(50, 50, 50, 0.98);  

	--color-blue: #039EFF;
  --header-text-color:#FFFFFF;
  --project-text-color: #AA9A7A;
	--secondary-text-color: #fff3de; /* 554835;  */ /* #9e9e9e; */
  --portf-bkgd-color: white;

  --font-fam: Helvetica, 'Microsoft Sans Serif', 'Sans Serif';  
  --project-font-fam: Helvetica, 'Microsoft Sans Serif', 'Sans Serif';  
	--font-size: 18px;
	--line-height: calc(1.44 * var(--font-size));
  --header-height: 92px;
  --header-vert-padding: 10px;
  --header-content-height: calc(var(--header-height) - (2 * var(--header-vert-padding)));

	/* --panel-menu-width: 55vw; */ /* This works. Only problem is it's not smooth on browser resize. */
	--panel-padding: 16px; 
  --side-panel-default-width: 100vw;
  --side-panel-portf-filter-width: var(--side-panel-default-width);
  --side-panel-extras-width: var(--side-panel-default-width);
  --side-panel-contact-width: var(--side-panel-default-width);

  --icon-close-size: 25px;

	--border-style: 1px solid #E8E8E8;
  --side-margin: 22px;

  --min-portf-img-width : 400px;
  --project-detail-width: 85vw;
  --project-detail-height: 90vh;
  
  --lightbox-img-height: calc(0.5 * var(--project-detail-height));
  --lightbox-img-width: calc((16.0/9.0) * var(--lightbox-img-height));  /* works as long as aspect ratio holds */
}

/****************************************************************************************************/
/* @media (max-width: calc(var(--min-portf-img-width) * 1.5)) {  */
/* @media (min-width: 800px) { 
  :root { 
    --side-panel-default-width: 55vw;
    --side-panel-portf-filter-width: 55vw;
    --side-panel-extras-width: 55vw;
    --side-panel-contact-width: 77vw;
  }
} */

@media (max-height: 800px) { 
  :root {
    /* --project-detail-height: 350px; */  /* something on mobile is bad. Still, this isn't fixing it. Not showing up in testing, only on actaul mobile. Hell. Absolute hell. */
  }
}

/****************************************************************************************************/

* {
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

html {
	font-size: var(--font-size);
	line-height: var(--line-height);
}

html, body {
	height: 100%; /* used for child elements that use %; they need the parent to have a defined height. Still. */ 
}

body {
  font-family: var(--font-fam);
  font-size: var(--font-size);
  font-weight: bold;
  margin: 0px;
}

/****************************************************************************************************/

a {
	text-decoration: none;
}

h1 {
	font-size: calc(1.5 * var(--font-size));
	line-height: calc(1.2 * var(--line-height));
	font-weight: 500;
}

h1 a {
  color: white;
}

h2 {
	padding: 0;
	margin: 16px 0;
	font-size: calc(1.1 * var(--font-size));
	line-height: var(--line-height);
	font-weight: 500;
}

.spacer {
	color: var(--secondary-text-color);
	margin-left: 2px;
	padding-right: 2px;
}

.center-inner-content {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.flex-center {
  text-align:center; 
  flex: 1;
} 


/************************************************************************************************/
/** HEADER **/
/************************************************************************************************/
#header {
  display: flex;
	align-items: center;
	border-bottom: var(--border-style);
	padding-left: var(--panel-padding);
  justify-content: space-between;
  background-color: var(--header-background-color);
  font-family: var(--font-fam);
  z-index: 1200;
  position: relative; /* this is needed for z-index to work */
}

#header {
  height: var(--header-height); 
}

#header #avatar {
  height: var(--header-height);
  max-height: var(--header-height);
  padding-top: var(--header-vert-padding);
  padding-bottom: var(--header-vert-padding);
}

#header #avatar img {
  height: var(--header-content-height);
  max-height: var(--header-content-height);
  padding-left: 7px;
  padding-right: 11px;
}

#header #bio {
  /* white-space: nowrap; */
}

#header h1 {
  color: var(--header-text-color);
  font-size: 1.1em;
  white-space: nowrap;
}

#header h2 {
  margin-top: calc(var(--line-height) * -0.65);
  color: var(--secondary-text-color); 
  font-size: 0.9em;
  line-height: 1.2em; 
  white-space: normal;
}

/* @media (max-width: calc(var(--min-portf-img-width) * 1.5)) {  */
@media (min-width: 600px) { 
  #header h1 { font-size: 1.4em; }
  #header h2 { font-size: 1.2em; white-space: nowrap; }
}


#header-menu {
  display: flex; 
  align-items: flex-start; 
  flex-wrap: wrap;  /* Handles small screens. Magic. */
  text-align: right;
  justify-content: right;
  color: var(--secondary-text-color);
  font-family: var(--font-fam);
  font-size: var(--font-size);
  font-weight: 500;
  width: 100%;
  /* height: 100%; */
  padding-right: 2px; 
  margin: auto;
  margin-top: 10px;
}

.menu-button, .menu-button.open {
  font-family: var(--font-fam);
  font-size: var(--font-size);
  background-color: transparent;
  border: none;
  cursor: pointer;
  /* white-space: nowrap; */
  padding: 5px;
  font-weight: 500;
}

.menu-button { 
  color: var(--secondary-text-color);
}

.menu-button.open, .menu-button:hover {
  color: var(--color-blue);
}

@media (max-width: 600px) { 
  #header-menu { 
    font-size: calc(0.8 * var(--font-size));
  }
  .menu-button {
    font-size: calc(0.8 * var(--font-size));
    font-weight: 400;
  }
}


/************************************************************************************************/
/** SIDE PANELS **/
/************************************************************************************************/
.side-panels, .side-panels.open {
	position: fixed;
	left: 100vw;
	top: var(--header-height);
  right: 0;
	height: calc(100% - var(--header-height));  /* This is VITAL! */
  overflow: auto;
  border: none;
  z-index: 1500;
	flex-direction: column;
  box-shadow: 0 0 8px rgba(0,0,0,.1);
  line-height: 2rem;
  display: flex;  /* have to have this or the transition will not work! */
  background: var(--secondary-text-color);
  color: black;
  /* transition: transform 0.5s ease, opacity 0.01s linear; */ /* doesn't work. don't know why. */
  transition: all 0.5s ease;  
  width: var(--side-panel-default-width);
}
  
.side-panels {
  opacity: 0%;
  transform: translateX(0);
}
.side-panels.open {
  opacity: 97%;
  /* transform: translateX(calc(-1 * var(--side-panel-default-width))); */
}

#side-panel-portf-filter {
  width: var(--side-panel-portf-filter-width);
}
#side-panel-portf-filter.open { 
  transform: translateX(calc(-1 * var(--side-panel-portf-filter-width)));
}


#side-panel-contact {
  width: var(--side-panel-contact-width);
}
#side-panel-contact.open { 
  transform: translateX(calc(-1 * var(--side-panel-contact-width)));
}

#side-panel-extras {
  width: var(--side-panel-extras-width);
}
#side-panel-extras.open { 
  transform: translateX(calc(-1 * var(--side-panel-extras-width)));
}


.close-side-panel { 
  display: grid;
  width: var(--icon-close-size);
  height: var(--icon-close-size);
  margin-right: 4px;
  margin-left: auto;
  cursor: pointer;
  background-size: var(--icon-close-size);
  -webkit-mask-image: url(res/ic_close_black_20dp.svg);
  -webkit-mask-position: 50% 50%;
  -webkit-mask-repeat: no-repeat;
  mask-image: url(res/ic_close_black_20dp.svg);
  mask-position: 50% 50%;
  mask-repeat: no-repeat;
  background-color:#000000;
}


/************************************************************************************************/
/** SIDE PANEL CONTENT **/
/************************************************************************************************/
.side-panel-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--panel-padding) var(--panel-padding) var(--panel-padding);
  margin-top: 20px;
  font-size: var(--font-size);
  line-height: var(--line-height);
  font-weight: 400;
  text-align: center;
}

.side-panel-content h2 {
  margin-bottom: 2px;
  padding-bottom: 0px;
  margin-top: 18px;
  border-top: none;
  padding-top: 6px;
  text-align: center;
  font-size: 1.35em;
  line-height: 1.55em;
}

@media (max-width: 800px) or (max-height: 500px) { 
  .side-panel-content h2 { 
    line-height: 1.1em;
    font-size: 1.1em;
  }
}

.side-panel-content a {
  position: relative;
  color: var(--color-blue);
}
.side-panel-content a:hover,
.side-panel-content a:hover .spacer,
.side-panel-content .selected {
  color: black;
}

#contact-content img {
  border: 2px white solid;
} 


/************************************************************************************************/
/** PORTFOLIO ROLES (FILTERS) **/
/************************************************************************************************/
#portf-filter-content {
  line-height: 1.4em;
  width: 100%;
}

#portf-roles-ckboxes {
  text-align: left;
  width: auto;
  display: inline-block;
}

#portf-roles-ckboxes span, #portf-roles-ckboxes label  {
  vertical-align: middle;     /* Will this work?? no. i want to valign these with label. */
  font-size: 1.15em;
  line-height: 1.3em;
  display: grid;
  grid-template-columns: 1.3em auto;
  gap: 0.2em;
  white-space: nowrap;
}

#portf-roles-ckboxes label {
  margin-top: 0.2em;
  cursor: pointer;
}

#btn-portf-roles-apply {
  font-family: var(--font-fam);
  font-size: var(--font-size);
  background-color: transparent;
  border: 2px solid black;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  padding: 10px;
  margin-top: 0.5em;
  font-weight: 500;
}


/************************************************************************************************/
/** PROJECTS PORTFOLIO **/
/************************************************************************************************/
#projects-grid-wrapper {
	position: absolute;
	border: 0px;
  top: calc(var(--header-height));
	left: 0;
	right: 0;
	width: 100%;
  height: calc(100% - var(--header-height));
	overflow: auto;
  padding-left: 0;
  transition: all 0.5s;
  background-color: var(--portf-bkgd-color);
}

#projects-grid {
	line-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--min-portf-img-width), 1fr));
  gap: 1px;
	transition: 0.3s;
}

#projects-grid.inactive { 
   opacity: 33%;
   /* z-index: -1000; */  /* not working */
   pointer-events: none;  /* this works! */
}

#projects-grid > div {
  overflow: hidden;
}

/* #projects-grid a img.is-loading {
  opacity: 0;
}   */

#projects-grid a img.is-loaded {
  animation: fadeInThumb ease 1s;
  animation-iteration-count: 1; 
  animation-direction: forward;
  --webkit-transition: 0.2s linear;
  transition: 0.2s linear;
}
@keyframes fadeInThumb {
  0% { opacity: .1; }
  100% { opacity: 1; }  
}

#projects-grid a:hover img.is-loaded {
	transform: scale(1.08);
}

.portf-placeholder {
  animation: pulsePlaceholder ease 1.5s;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}
@keyframes pulsePlaceholder {
  0% { opacity: .5; scale: 1 }
  100% { opacity: 1; scale: 1.5 }
}


.project-in-grid.filtered-in {
  /* transform: scale(1);
  transition: all 3s ease;
  -webkit-transition: all 3s ease; 
  animation: -scale-in 3s forwards; */
  display: block;
}

.project-in-grid.filtered-out {
  display: none;
} 

/* No good. */
/* .project-in-grid.filtering-out {
  animation: -scale-out 3s forwards;
} 
@keyframes -scale-out {
  0%   { scale: 1; }
  100% { scale: 0; }
}
@keyframes -scale-in {
  0%   { scale: 0; }
  100% { scale: 1; }
}
*/

/******************************************************************************************/
/** PROJECT LIGHTBOX **/
/******************************************************************************************/
#project-lightbox { 
  position: fixed;
  /* opacity: 0; */
  display: flex;  /* Also messes with transitions. */
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .7);  
  border: 0px; 
  overflow: hidden;
  width: 100vw; 
  transition: all 0.4s ease-in-out;
  -webkit-transition: all 0.4s ease-in-out;
  transform-origin: 50% 50%;
  height: calc(100vh + var(--header-height));
  top: 0; /* calc(var(--header-height) * -1); */
  z-index: 5000;
  transition: all 0.4s ease;
}

#project-lightbox.open { 
  /* z-index: 5000; */
  opacity: 1;
  cursor: url('res/cursor-close.png'), pointer;
  transform: scale(1);
}

#project-lightbox.closed { 
  /* z-index: -1;       */
  opacity: 0;
  transform: scale(0);
  pointer-events: none;  /* This is needed so we can click underneath and have transitions. */
}

#project-lightbox #lightbox-inner {
  position: fixed;
  max-width: var(--project-detail-width);

  height: var(--project-detail-height);

  top: calc((100vh - var(--project-detail-height))/2);
  background: var(--lightbox-background-color);
  border-radius: 0.5em;
  border: 0.35em var(--secondary-background-color) solid; 
  overflow-y: auto; /* not scroll. Else it has disabled scrollbar */
  transition: all 0.33s ease;
  -webkit-transition: all 0.33 ease;
  cursor: auto;
}

@media (max-width: 600px) { 
  #project-lightbox #lightbox-inner {
    top: 10px;      /* There have to be browswer inconsistencies in reporting height. Just band-aids. */
  }
}

@media (max-height: 480px) { 
  #project-lightbox #lightbox-inner {
    height: 280px;    /* Very sloppy. But things just are not working as they are supposed to. It's going beyond the browser height, which is not calculated correctly. At the end of my rope. */
  }
}

#project-lightbox.open #lightbox-inner {
  opacity: 1;
}

#project-lightbox.closed #lightbox-inner {
  opacity: 0;
  max-width: 0;
  max-height: 0;
 /* helps smooth the transition: */
  min-width: calc(0.3 * var(--project-detail-width));
  min-height: calc(0.3 * var(--project-detail-height)); 
}

.project-inactive {
  display: none !important;   /* Not sure why now I have to have this. but i do. Bug in my loop???? */
}

.project-active {
  display: grid;
}

#project-lightbox.closed .project-detail {
  opacity: 0;
}

#project-lightbox.open .project-detail {
  opacity: 1;
}

.project-detail { 
  position: relative;
  padding: 0.5em 1.2em 0.5em 1.2em;
  display: block; /* grid; */
  text-align: center;
  /* place-items: center;
  justify-content: center;
  justify-self: center; */
}

.project-detail div {
  color: var(--project-text-color);
  text-align: center;
  font-family: var(--project-font-fam);
  place-self: center;
  padding-top: 2px;
  padding-bottom: 2px;
  font-size: 1em;
  font-weight: 300;
  text-align: left;
  line-height: 1em;
}

.project-detail .lightbox-img {
  /* width: var(--lightbox-img-width); */
  padding-top: 0.5em;
  padding-bottom: 0.1em;
  max-width: var(--lightbox-img-width);
}

.lightbox-img img {
 width: 100%;    /* of the parent div */
}

.project-detail .proj-title,
.project-detail .partners,
.project-detail .tools,
.project-detail .tools-and-role,
.project-detail .my-role,
.project-detail .proj-description {
  /* width: var(--lightbox-img-width); */
  text-align: left;
  padding-left: 2px;
  line-height: 1em;
  font-weight: 400;
  font-size: 1em;
  overflow-wrap: break-word;
}


.project-detail .proj-title {
  font-size: 1.33em;
  font-weight: 600;
  /* padding-bottom: 0.5em; */
  padding-top: 0.3em;
}

.project-detail .tools-and-role { 
  padding-top: 1em;
}

/* .project-detail div.my-role {
  font-style: italic;
  padding-top: 0.8em;
  padding-bottom: 0.8em;
} */

.project-detail .proj-description {
  padding-top: 0.8em;
  line-height: 1.25em !important;
}

.project-detail .proj-description a {
  color: var(--color-blue);
}


.project-detail .proj-links {
  /* width: var(--lightbox-img-width); */
  text-align: left;
  padding-left: 2px;
  padding-top: 0.8em;
  color: var(--color-blue);
  line-height: 1.25em;
  font-weight: 400;
  font-size: 1em;
  overflow-wrap: anywhere;
}

.project-detail .proj-links a {
  color: var(--color-blue);
  text-decoration: underline;
  overflow-wrap: anywhere;
  font-weight: 400;
  letter-spacing: 0.05ch;
}

/* #tooltip-filter-roles { display: none; } */