/* Custom Properties */
:root {
    --primary-color: #6495ED;
    --text-color: #f4f4f4;
    --background-color: #1a1a1a;
    --card-background: #2a2a2a;
    --border-radius: 8px;
    --transition-speed: 0.5s;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    --navbar-height: 60px;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth; /* Enables smooth scrolling for anchor links */
    scroll-padding-top: var(--navbar-height)
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    padding-top: var(--navbar-height); /* Add padding to prevent content from hiding under sticky navbar */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.container h2 {
    padding-bottom: 0.5rem;
}

/* Hamburger button */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 25px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1100; /* above nav drawer */
}

.hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--text-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Animate into an X when active */
.hamburger span {
    transform-origin: center; /* ensures rotations pivot correctly */
}
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Drawer styles */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -250px; /* hidden off-screen */
        width: 250px;
        height: 100vh;
        background-color: var(--background-color);
        flex-direction: column;
        align-items: flex-start;
        padding: 4rem 2rem;
        gap: 1rem;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.5);
        transition: right 0.3s ease;
        z-index: 1000;
    }

    .nav-links a {
        font-size: 1.5rem;
        font-weight: 500;
        text-decoration: none;
        color: var(--text-color);
        position: relative;
        transition: color 0.3s ease;
    }

    /* Drawer visible */
    .nav-links.active {
        right: 0;
    }

    /* Nice underline hover effect */
    .nav-links a::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 0;
        height: 2px;
        background-color: var(--primary-color);
        transition: width 0.3s ease;
    }

    .nav-links a:hover::after {
        width: 100%;
    }
}

/* Navigation Bar */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--navbar-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    background-color: rgba(26, 26, 26, 0.8); /* Semi-transparent background */
    backdrop-filter: blur(10px); /* Frosted glass effect */
    z-index: 1000;
    transition: background-color 0.5s ease;
}

#navbar.scrolled {
    background-color: var(--background-color); /* Solid background on scroll */
    box-shadow: var(--shadow);
}

.nav-brand {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    margin-left: 2rem;
    position: relative;
    padding: 0.25rem 0;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Header & Hero Section */
.hero {
    height: calc(100vh - var(--navbar-height));
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: #000000;
    position: relative;
    overflow: hidden;
    user-select: none;
}

/*  
    TODO: add a transition to this so it blends with 
    the color of the next section as you scroll
*/
#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0; /* behind text */
    pointer-events: none; /* important: allow mouse through */
}

.hero-content {
    position: relative;
    z-index: 5; /* ensure text stays above canvas */
}

.hero-content h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1rem;
    position: relative;
    animation: text-shadow-pulse 2s infinite ease-in-out;
}

@keyframes text-shadow-pulse {
    0%, 100% { text-shadow: 0 0 5px var(--primary-color); }
    50% { text-shadow: 0 0 20px var(--primary-color); }
}

/* Animations for scrolling */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Hero text fade-in */
.fade-in-up {
    opacity: 0;
    animation: fade-in-up-animation 1s forwards;
    animation-delay: 0.5s;
}

@keyframes fade-in-up-animation {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Navigation fade-in from top */
.fade-in-down {
    opacity: 0;
    animation: fade-in-down-animation 0.7s forwards;
}

@keyframes fade-in-down-animation {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons */
.cta-button, .project-link {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-top: 1rem;
}

.cta-button:hover, .project-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

/* Secondary Button */
.secondary-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background-color: transparent; /* no fill */
    color: var(--primary-color);
    border: 2px solid var(--primary-color); /* outlined */
    border-radius: 50px;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, color 0.3s ease;
    margin-top: 1rem;
    margin-left: 0.5rem;
}

.secondary-link:hover {
    background-color: var(--primary-color); /* fill on hover */
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

/* !important to override lazy loading on imgs */
.secondary-link img {
    width: 15px !important;
    height: 15px !important;
    object-fit: contain;
    filter: none !important;
}

.secondary-link svg {
    width: 15px;
    height: 15px;
    transition: fill 0.3s ease, color 0.3s ease;
}

/* Links */
a {
    color: var(--primary-color);
}

/* Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 0.5rem;
}

.project-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.project-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    filter: blur(10px); /* Placeholder blur effect */
    transition: filter 0.5s ease;
}

.project-card img.loaded {
    filter: blur(0); /* Remove blur when image is loaded */
}

.card-content {
    padding: 1.5rem;
}

/* Contact Form Styling */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.contact-form .form-group {
    display: flex;
    flex-direction: column;
}

.contact-form label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.contact-form input,
.contact-form textarea {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid #555;
    background-color: var(--card-background);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    resize: none;
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(100, 149, 237, 0.5);
    outline: none;
}

.contact-form button {
    align-self: flex-start;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-form button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.contact-form.disabled {
    opacity: 0.6;           /* fade out */
    pointer-events: none;    /* disable all interactions */
    transition: opacity 0.5s ease;
}

/* Form Status Messages */
.form-status {
    margin-top: 2em;
    padding: 1em;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 600;
    transform: translateY(-10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.form-status.success .form-status.error {
    color: white;
    opacity: 1;
    transform: translateY(0);
}

.form-status.success {
    background-color: #28a745;
}

.form-status.error {
    background-color: #dc3545;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--card-background);
    color: #999;
}

.homeserver {
    height: 100vh;
}

.homeserver h1 {
    text-align: center;
    font-size: clamp(2.5rem, 5vw, 4rem);
}

/* Project Grid */
.homeserver-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    padding: 0rem 4rem;
}

.homeserver-grid a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.homeserver-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.homeserver-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.homeserver-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: filter 0.5s ease;
}

.homeserver-content {
    padding: 1.5rem;
}