body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    scroll-behavior: smooth;
    background-color: #454545;
  }

.top {
    padding-top: 27vh; /* Match navbar height */
    margin-top: 0; /* Remove margin */
}

section {
    padding-top: 0; /* Remove section padding since it's handled by .body */
    margin-top: 0;
    overflow-y: auto;
}
 
p {
    font-family: Garamond, 'Times New Roman', Times, serif;
    font-size: clamp(12px, 2.5rem, 48px);
    overflow-y: auto;
}

h2 {
    font-family: Garamond, 'Times New Roman', Times, serif;
    font-size: clamp(18px, 5rem, 86px);
    color: white;
    font-weight: bold;
    margin-bottom: 2vh;
}

.body {
    padding: 1.5vw;
    font-family: Garamond, 'Times New Roman', Times, serif;
    font-size: clamp(12px, 4rem, 48px);
    height: 100vh;
    padding-top: 27vh; /* Match navbar height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 0;
    min-height: calc(100vh - 27vh); /* Account for navbar height */
}

.bottom {
    height: 90vh;
}

.science {
    width: 80vw;
}

.citation {
    font-size: clamp(8px, 1.5rem, 24px);
    vertical-align: super;
}

.flip-card {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 25vw;
    margin-right: 1vw; 
    height: 45vh;
    perspective: 1000px;
    cursor: pointer;
    background-color: #d5c9c9;
    border: 0.5vw ridge #5c5c5c;
    box-shadow: 12px 12px 18px rgba(213, 201, 201, 0.8);
}

.flip-card p {
    font-size: clamp(12px, 2rem, 48px);
    overflow-y: auto;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.flip-card-back {
    transform: rotateY(180deg);
}

.flip-card.first::after {
    content: "click to flip";
}

.flip-card.first.flipped::after {
    content: "click to flip back";
}

.flip-card::after {
    content: "";
    position: absolute;
    inset: 0;  /* covers entire card */
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.3) 80%,
        rgba(0, 0, 0, 0.6) 100%
    );
    color: white;
    padding: 5px 10px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    font-size: clamp(8px, .75rem, 16px);
    font-family: Arial, sans-serif;
    pointer-events: none;
    z-index: 1;
}

.flip-card.flipped::after {
    content: "";
    position: absolute;
    inset: 0;  /* covers entire card */
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.3) 80%,
        rgba(0, 0, 0, 0.6) 100%
    );
    color: white;
    padding: 5px 10px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    font-size: clamp(8px, .75rem, 16px);
    font-family: Arial, sans-serif;
    pointer-events: none;
    z-index: 1;
}

.flip-card-front p, .flip-card-back p {
    margin: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow-y: auto;
}

.flip-card a.citation {
    text-decoration: none;
    color: inherit;
}

.flip-card-front a.citation:hover, .flip-card-back a.citation:hover {
    text-decoration: underline;
}

.information-section {
    margin: 20px 0;
    width: 85vw;
    min-height: 100px;
    height: 50vh;
    display: flex;
    flex-direction: row;  /* default - items flow left to right */
    justify-content: space-around;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.information-section::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.summary {
    background-color: #d5c9c9;
    border: 0.5vw ridge #5c5c5c;
    box-shadow: 12px 12px 18px rgba(213, 201, 201, 0.8);
    padding: 1.5vw;
    width: 85vw;
    text-align: center;
}

@media (max-width: 600px) {
    section {
        padding-top: 0;
        margin-top: 0;
    }

    .top {
        padding-top: 27vh;
        margin-top: 0;
        padding-bottom: 2vh;
    }


    .information-section {
        align-items: space-between;
        width: 100vw;
    }

    .flip-card {
        min-width: 85vw;
        height: 90%;
        margin: 1.5%; /* Remove right margin on small screens */
    }

    .flip-card p {
        font-size: clamp(5px, 1rem, 24px);
    }
    
    .flip-card-inner {
        width: 85vw;
        height: 95%;
    }

    .body {
        justify-content: center;
        align-items: center;
        text-align: center;
        padding-left: 0;
        padding-right: 0;
        font-size: clamp(5px, 1rem, 24px);
        padding-top: 27vh;
        margin-top: 0;
    }

    .overlay {
        opacity: 1;
    }


    h2 {
        font-size: clamp(5px, 2rem, 24px);
        margin-top: 2vh; /* Add space above headers */
    }

    .science, .summary {
        width: 95vw;
        margin: 2vh auto;
    }

    .summary {
        font-size: clamp(5px, 1rem, 24px);
        max-height: 80%;
    }

    .information-section {
        width: 95vw;
        margin: 0 auto;
        padding: 0;
    }

    .citation {
        font-size: clamp(3px, .5rem, 24px);
        vertical-align: super;
    }

}