:root {
    --bg-color: #f0f4f8;
    --text-color: #333333;
    --accent-color: #00bcd4;
    --secondary-accent: #9c27b0;
    --card-bg: rgba(255, 255, 255, 0.65);
    --card-hover-bg: rgba(255, 255, 255, 0.85);
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Roboto Mono', monospace;
    --gap: 20px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    /* Adding a white overlay on top of the background image */
    background-image: linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), url('../images/background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-color);
    font-family: var(--font-body);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Changed for scrolling */
    padding: 4rem 2rem;
}

.container {
    width: 100%;
    max-width: 1000px;
    /* Wider for Bento Grid */
    z-index: 10;
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 4rem;
}

h1 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 0.5rem;
    position: relative;
    display: inline-block;
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.8);
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 var(--secondary-accent);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
    opacity: 0.7;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 var(--accent-color);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
    opacity: 0.7;
}

@keyframes glitch-anim {
    0% {
        clip: rect(30px, 9999px, 10px, 0);
    }

    20% {
        clip: rect(80px, 9999px, 5px, 0);
    }

    40% {
        clip: rect(10px, 9999px, 60px, 0);
    }

    60% {
        clip: rect(50px, 9999px, 20px, 0);
    }

    80% {
        clip: rect(20px, 9999px, 90px, 0);
    }

    100% {
        clip: rect(70px, 9999px, 40px, 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(10px, 9999px, 80px, 0);
    }

    20% {
        clip: rect(60px, 9999px, 10px, 0);
    }

    40% {
        clip: rect(30px, 9999px, 50px, 0);
    }

    60% {
        clip: rect(90px, 9999px, 20px, 0);
    }

    80% {
        clip: rect(40px, 9999px, 70px, 0);
    }

    100% {
        clip: rect(20px, 9999px, 30px, 0);
    }
}

.konami-code {
    font-size: 1.2rem;
    color: var(--secondary-accent);
    letter-spacing: 8px;
    font-weight: bold;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.8);
    margin-top: 1rem;
}

/* Bento Grid Layout */
.link-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 Columns */
    grid-auto-rows: minmax(150px, auto);
    gap: var(--gap);
}

/* Responsive Spans for Bento Effect */
.link-list li:nth-child(1) {
    /* Profile */
    grid-column: span 2;
    grid-row: span 1;
}

.link-list li:nth-child(6) {
    /* Mind Map */
    grid-column: span 2;
}

.link-list li {
    display: flex;
    /* Ensure li fills the grid cell */
}

.card {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 20px;
    /* Softer corners */
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.05),
        inset 0 0 20px rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(15px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy transition */
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    background: var(--card-hover-bg);
    transform: translateY(-10px) scale(1.02);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 0 2px var(--accent-color);
    /* Border glow */
    z-index: 1;
}

.card:hover::before {
    opacity: 1;
}

.icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    margin-right: 0;
    /* Centered layout */
    color: var(--secondary-accent);
    transition: transform 0.3s ease;
}

.card:hover .icon {
    transform: scale(1.2) rotate(5deg);
    color: var(--accent-color);
}

.text {
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
}

footer {
    margin-top: 5rem;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
    color: #555;
    font-weight: bold;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .link-list {
        grid-template-columns: 1fr;
        /* Single column on mobile */
        gap: 1rem;
    }

    .link-list li:nth-child(n) {
        grid-column: span 1;
        /* Reset spans */
        grid-row: span 1;
    }

    .card {
        flex-direction: row;
        justify-content: flex-start;
        padding: 1.5rem;
        min-height: auto;
    }

    .icon {
        margin-bottom: 0;
        margin-right: 1rem;
        font-size: 1.5rem;
    }

    .text {
        text-align: left;
    }
}
