body, html {
    position: relative;
    background-color: white;
    color: black;
    width: 100vw;
    height: 100vh;
    margin: 0;
    overflow-x: hidden;
    transition: all 1s;
}

body.hidden {
    background-image: url('../images/loading.gif');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100px 100px; /* half of actual gif res */
}

body:not(.hidden) {
  background-image: none;
}

body.hidden * {
    opacity: 0.001;
}

html {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

html::-webkit-scrollbar {
    display: none;
}

/* Used to toggle dark mode */
.dark-mode {
    background-color: #252525;
    color: white;
}

a { transition: all 0.5s }
.dark-mode a { color: aqua }

h1 {
    font-family: 'Playfair Display', sans-serif;
    font-size: 40px;
    margin: 0;
}

h2 {
    font-family: 'Playfair Display', sans-serif;
    font-size: 30px;
    margin: 0;
}

h3 {
    font-family: 'Lato', sans-serif;
    font-size: 20px;
    margin: 0;
}

p {
    font-family: 'Lato', sans-serif;
}

.centered {
    text-align: center;
}

#portfolio-container {
    position: relative;
    top: 0;
    left: 0;
    height: fit-content;
    margin: 5em;

    display: grid;
    flex-direction: column;
    gap: 5em;

    transition: all 0.5s;
}

#projects-grid {
    position: relative;
    top: 0;
    left: 0;
    height: fit-content;

    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40vw, 1fr)); /* Creates a responsive grid */
    gap: 2em; /* Adjust the gap between grid items */
    
    transition: all 0.5s;
}

#portfolio-container.hidden {
    left: -100%;
    opacity: 0;
}

.project-link {
    position: relative;
    width: auto;
    height: 300px;
    padding: 0;
    border: none;
    background: none;
    background-color: black;
    overflow: hidden;
    cursor: pointer;
}

.project-info {
    opacity: 0;
    z-index: 10;
    transition: 0.5s;
}

.project-link:hover .project-info {
    opacity: 1;
}

.project-title {
    position: relative;
    left: 50%;
    top: 0;
    /* transform: translateX(-50%); */
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    color: white;
}

.project-status-tags {
    position: relative;
    left: 50%;
    margin: 0;
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
}

.project-status-tags > img {
    padding: 0.2em;
}

.project-link .thumbnail {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
    -webkit-transform: translateX(-50%) translateY(-50%);
    object-fit: cover;
    height: 100%;
    width: 100%;
    opacity: 1;
    transition: .4s ease;
}

.project-link:hover .thumbnail {
    opacity: 0.4;
}

.project-link > div {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    width: 100%;
    height: fit-content;
}


/* PROJECT VIEWPORT */

#project-viewer {
    position: absolute;
    padding: 5em;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;

    transition: all 0.5s;
}

#project-viewer.hidden {
    left: 100%;
    opacity: 0;
}

#markdown-renderer {
    position: absolute;
    width: 80%;
}

#markdown-renderer > div > img {
    display: inline;
    max-height: 20px;
    width: auto;
    height: auto;
}

/* youtube embeds */
#markdown-renderer > iframe {
    width: min(450px, 80vw);
    height: min(300px, 50vw);
}

#close-project {
    position: absolute;
    top: 35px;
    left: 55px;
    opacity: 0.5;
    font-family: 'Lato', sans-serif;

    font-size: 25px;

    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.5s;
}

#close-project:hover {
    opacity: 0.9;
    font-size: 30px;
}

/* CSS for dark mode toggle switch */
.toggle-switch {
    position: fixed;
    top: 2em;
    right: 2em;
    width: 100px;
    height: 50px;
    --light: #fff;
    --dark: #252525;
    --link: rgb(27, 129, 112);
    --link-hover: rgb(24, 94, 82);
}

.switch-label {
    position: absolute;
    width: 100%;
    height: 45px;
    background-color: var(--dark);
    border-radius: 30px;
    cursor: pointer;
    border: 3px solid var(--dark);
}

.checkbox {
    position: absolute;
    display: none;
}

.slider {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 25px;
    -webkit-transition: 0.3s;
    transition: 0.3s;
}

.checkbox:checked~.slider {
    background-color: var(--light);
}

.slider::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 10px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    -webkit-box-shadow: inset 12px -4px 0px 0px var(--light);
    box-shadow: inset 12px -4px 0px 0px var(--light);
    background-color: var(--dark);
    -webkit-transition: 0.3s;
    transition: 0.3s;
}

.checkbox:checked~.slider::before {
    -webkit-transform: translateX(50px);
    -ms-transform: translateX(50px);
    transform: translateX(50px);
    background-color: var(--dark);
    -webkit-box-shadow: none;
    box-shadow: none;
}

/* Markdown images patch for mobile devices */
@media screen and (orientation:portrait) {
    #markdown-renderer {
        left: 10vw;
        width: 80vw;
    }
    #markdown-renderer img {
        width: 75vw;
    }
}
@media screen and (orientation:landscape) {
      #markdown-renderer img {
          height: 200px
      }
}