body{
  font-family: 'Open Sans', arial, sans-serif;
  background:rgb(123, 158, 158);

}
*{
  margin:0;
  padding:0;
}
#categories{
  overflow:hidden;
  width:90%;
  margin:0 auto;
  padding-bottom: 5%;
}
.clr:after{
  content:"";
  display:block;
  clear:both;
}
#categories li{
  position:relative;
  list-style-type:none;
  width:20%; /* previously 13% */
  padding-bottom: 23%; /* previously 15.01154734%*/
  /*width:27.85714285714286%; /* = (100-2.5) / 3.5 */
  /*padding-bottom: 32.16760145166612%; /* =  width /0.866 */
  float:left;
  overflow:hidden;
  visibility:hidden;
 
  -webkit-transform: rotate(-60deg) skewY(30deg);
  -ms-transform: rotate(-60deg) skewY(30deg);
  transform: rotate(-60deg) skewY(30deg);
}

#categories li:nth-child(n){
 margin:0.1%;
 margin-left:0.8%;
}

/* previously #categories li:nth-child(14n+7){*/
#categories li:nth-child(8n+4){
  margin-left:0.8%;
}
/* previously #categories li:nth-child(14n+8), #categories li:nth-child(14n+9), #categories li:nth-child(14n+10), #categories li:nth-child(14n+11), #categories li:nth-child(14n+12), #categories li:nth-child(14n+13), #categories li:nth-child(14n+14) {*/
#categories li:nth-child(8n+5), #categories li:nth-child(8n+6), #categories li:nth-child(8n+7), #categories li:nth-child(8n+8) {
	margin-top: -5%; /* previously -3.2376502%;*/
  margin-bottom: -5%; /* previously -3.2376502%;*/
  /* TranslationX changed to suit new changes in margin sizes */
  -webkit-transform: translateX(52.33%) rotate(-60deg) skewY(30deg); 
  -ms-transform: translateX(52.33%) rotate(-60deg) skewY(30deg);
  transform: translateX(52.33%) rotate(-60deg) skewY(30deg);
}

/*
#categories li:nth-child(3n+2){
 margin:0 1%;
}
#categories li:nth-child(6n+4){
  margin-left:0.5%;
}
#categories li:nth-child(6n+4), #categories li:nth-child(6n+5), #categories li:nth-child(6n+6) {
  margin-top: -6.9285714285%;
  margin-bottom: -6.9285714285%;
  
  -webkit-transform: translateX(50%) rotate(-60deg) skewY(30deg);
  -ms-transform: translateX(50%) rotate(-60deg) skewY(30deg);
  transform: translateX(50%) rotate(-60deg) skewY(30deg);
}*/
#categories li *{
  position:absolute;
  visibility:visible;
  
}
#categories li:hover { 
  transform: rotate(-60deg) skewY(30deg) scale(1.1); /* Maintain shape while scaling */
  z-index: 10;
  cursor:pointer;
}
/* Offset Hexagon rows to enable full styling capabilities*/
#categories li:nth-child(8n+5):hover, #categories li:nth-child(8n+6):hover, #categories li:nth-child(8n+7):hover, #categories li:nth-child(8n+8):hover {
	margin-top: -5%; /* previously -3.2376502%;*/
  margin-bottom: -5%; /* previously -3.2376502%;*/
  -webkit-transform: translateX(52.33%) rotate(-60deg) skewY(30deg) scale(1.1);
  -ms-transform: translateX(52.33%) rotate(-60deg) skewY(30deg) scale(1.1);
  transform: translateX(52.33%) rotate(-60deg) skewY(30deg) scale(1.1);
}
#categories li > div {
  width: 100%;
  height: 100%;
  text-align: center;
  color: #fff;
  overflow: hidden;
  display: flex; /* Added to align text to centre */
  flex-direction: column;/* Added to align text to centre */
  justify-content: center;/* Added to align text to centre */
  align-items: center; /* Added to align text to centre */
  -webkit-transform: skewY(-30deg) rotate(60deg);
  -ms-transform: skewY(-30deg) rotate(60deg);
  transform: skewY(-30deg) rotate(60deg);
  -webkit-backface-visibility:hidden;
}

/* HEX CONTENT */
#categories li img{
  left:-100%; right:-100%;
  width: auto; height:100%;
  margin:0 auto;   
  max-width:none;
}

#categories div h1, #categories div p{
  width:100%;
  padding:0 5%;
  background-color:#fff3d5;
  opacity:0.6;
  font-family: 'Open Sans', Arial, sans-serif; /* Ensured font uniformity */
  -webkit-transition: top .2s ease-out, bottom .2s ease-out, .2s padding .2s ease-out;
  -ms-transition: top .2s ease-out, bottom .2s ease-out, .2s padding .2s ease-out;
  transition: top .2s ease-out, bottom .2s ease-out, .2s padding .2s ease-out;
}
#categories li h1{
  bottom:110%;
  font-weight:bold;
  font-size:0.9em; /*Increased size to improve visibility */
  padding-top:50%;
  padding-bottom:50%;
}

#categories li h1:after{
  content:'';
  display:block;
  position:absolute;
  bottom:-1px; left:45%;
  width:10%;
  text-align:center;
  z-index:1;
  border-bottom:2px solid #fff;
}
#categories li p{
	padding-top:50%;
	top:110%;
	padding-bottom:50%;
  font-size:0.8em; /*Increased size to improve visibility */
  color:black;
}

#categories li p{
    padding-top:50%;
    top:110%;
    padding-bottom:50%;
    font-size:0.8em; /*Increased size to improve visibility */
    color:black;
  }

/* HOVER EFFECT  */

#categories li div:hover h1 {
  bottom:50%;
  padding-bottom:5% !important;
  margin:0;
  border-bottom:0;
  line-height:100%;

}

#categories li div:hover p{
  top:50%;
  padding-top:10%;
  line-height:100%;
  
}
/* Added changing font size for phones */
@media screen and (max-width: 600px){
  #categories li h1{
    bottom:110%;
    font-weight:bold;
    font-size:0.5em; /*Increased size to improve visibility */
    padding-top:50%;
    padding-bottom:50%;
  }
  #categories li p{
    padding-top:50%;
    top:110%;
    padding-bottom:50%;
    font-size:0.4em; /*Increased size to improve visibility */
    color:black;
  }
}





  