/* Global Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #0056b3;
    --primary-hover: #004494;
    --secondary-color: #00a8e8;
    --accent-color: #ffcc00;
    --text-color: #333333;
    --text-light: #555555;
    --bg-color: #f4f8fb;
    --card-bg: #ffffff;
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15);
    --font-main: 'Poppins', sans-serif;
    --transition-speed: 0.3s;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Links */
a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover {
    color: var(--primary-color);
}

/* Utility Classes */
.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Global Card Styles */
.study-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-top: 2rem;
}

.study-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
    transition: all var(--transition-speed);
    padding-top: 3rem;
    /* Added space for category label */
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.study-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

/* Category Label */
.category-label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    background: var(--secondary-color);
    border-radius: 20px;
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-math {
    background: linear-gradient(135deg, #00a8e8, #0077b6);
}

.category-cs {
    background: linear-gradient(135deg, #ff6f61, #d64535);
}

.category-phy {
    background: linear-gradient(135deg, #69c089, #4ca86e);
}

.category-gf {
    background: linear-gradient(135deg, #c083d8, #9b59b6);
}

.study-card .content {
    display: flex;
    /* Enables flexbox */
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem;
    position: relative;
    /* Ensures proper positioning for absolute elements */
    min-height: 100px;
}

.study-card .content h3 {
    margin: 0;
    /* Removes default margins */
    font-size: 1.25rem;
    font-weight: 600;
    text-align: left;
    word-wrap: break-word;
    /* Ensures long titles wrap instead of overlapping */
    color: var(--text-color);
    line-height: 1.4;
    padding-right: 2.5rem;
    /* Make space for the semester badge */
}

.study-card .semester {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: rgba(0, 86, 179, 0.1);
    color: var(--primary-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
    /* Ensures it stays on top */
}

/* Response Images */
img {
    max-width: 100%;
    height: auto;
}

/* Mobile Adjustments */
@media (max-width: 550px) {

    /* Increased breakpoint for better safety */
    .study-cards {
        grid-template-columns: 1fr;
        /* Force single column on smaller screens */
        gap: 1.5rem;
        padding-right: 5px;
        /* Prevention of edge touching */
    }

    .category-label {
        font-size: 0.65rem;
        padding: 3px 10px;
    }

    .study-card .semester {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
        top: 0.8rem;
        /* Slight adjustment */
        right: 0.8rem;
    }
}

/* Make the card clickable */
.card-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
}