/* --- Base Styles & Variables --- */
:root {
    --bg-color: #1a1a1d; /* Dark background */
    --primary-color: #c3073f; /* Accent red */
    --secondary-color: #6f2232; /* Darker accent */
    --text-color: #f0f0f0; /* Light text */
    --text-muted-color: #a0a0a0; /* Muted text */
    --card-bg-color: #2a2a2e; /* Slightly lighter dark for cards */
    --hover-glow: 0 0 15px rgba(195, 7, 63, 0.7); /* Glow effect */
    --font-primary: 'Poppins', sans-serif;
    --section-bg-overlay: rgba(26, 26, 29, 0.8); /* Overlay for non-alt sections */
    --profile-img-size: 150px; /* Control profile image size */
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-color); /* Base body background */
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative; /* Needed for z-index stacking */
}

/* --- Canvas Styling --- */
#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0; /* Behind sections, above body background */
    pointer-events: none;
    opacity: 0.35; /* Adjust visibility */
}

/* --- Main Content Structure --- */
main {
    position: relative; /* Establish stacking context for sections */
    z-index: 2; /* Ensure main content is above canvas */
}

/* --- Utility Classes --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative; /* Ensure container content is stackable */
    z-index: 3; /* Above section background/overlay */
    p {
        text-align: center;
    }
}

.full-height {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative; /* Needed for z-index */
    z-index: 2;
}

.content-section {
    padding: 80px 0;
    position: relative; /* Sections establish stacking context */
    z-index: 2; /* Sections sit above the canvas */
    /* Default sections get a semi-transparent overlay */
    background-color: var(--section-bg-overlay);
}

/* Specific backgrounds override the default overlay */
.alt-bg {
    background-color: var(--card-bg-color); /* Solid background */
}
#hero {
     /* Keep hero gradient + image */
    background: linear-gradient(rgba(26, 26, 29, 0.85), rgba(26, 26, 29, 0.95)), url('placeholder-hero-bg.jpg') no-repeat center center/cover; /* Use actual background image */
     background-color: transparent; /* Override default section bg */
     text-align: center; /* Center hero content */
}

h1, h2, h3 {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
    margin-top: 1.5rem; /* Space below profile picture */
}

h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
    margin: 10px auto 0;
    border-radius: 2px;
}


p {
    margin-bottom: 1rem;
    color: var(--text-muted-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: lighten(var(--primary-color), 10%);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    background-color: #444; /* Fallback for broken images */
    color: #888;
    text-align: center;
    line-height: 1.5;
}

/* --- Header / Navigation --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 0;
    background-color: rgba(26, 26, 29, 0.9);
    backdrop-filter: blur(5px);
    z-index: 1000; /* Highest */
    transition: background-color 0.3s ease;
}

.main-header nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-header nav ul li {
    margin: 0 15px;
}

.main-header nav ul li a {
    color: var(--text-muted-color);
    font-weight: 400;
    padding: 5px 10px;
    position: relative;
    transition: color 0.3s ease, font-weight 0.3s ease;
}

.main-header nav ul li a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.main-header nav ul li a:hover {
    color: var(--text-color);
}

.main-header nav ul li a:hover::after {
    width: 50%;
}

.main-header nav ul li a.active {
    color: var(--text-color);
    font-weight: 600;
}

.main-header nav ul li a.active::after {
    width: 100%;
}


/* --- Hero Section --- */
.hero-section {
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 3; /* Above hero background */
    display: flex; /* Arrange items vertically */
    flex-direction: column;
    align-items: center; /* Center items horizontally */
}

#profile-picture {
    width: var(--profile-img-size);
    height: var(--profile-img-size);
    border-radius: 50%; /* Make it circular */
    object-fit: cover; /* Ensure image covers the area well */
    border: 4px solid var(--primary-color); /* Optional border */
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    margin-bottom: 1.5rem; /* Space below picture */
}

.hero-content .subtitle {
    font-size: 1.4rem;
    color: var(--text-muted-color);
    margin-bottom: 2rem;
    font-weight: 300;
}

.cta-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 5;
}

.cta-button:hover {
    background-color: darken(var(--primary-color), 10%);
    box-shadow: var(--hover-glow);
    transform: translateY(-3px);
}


/* --- Skills Section --- */
.skills-grid {
    display: flex; /* Use flexbox for wrapping */
    flex-wrap: wrap;
    gap: 15px; /* Space between items */
    justify-content: center; /* Center items horizontally */
    margin-top: 2rem;
}

.skill-item {
    background-color: var(--secondary-color); /* Use darker accent */
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: 20px; /* Pill shape */
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease, transform 0.3s ease;
    cursor: default; /* Indicate non-interactive */
}

.skill-item:hover {
    background-color: var(--primary-color); /* Highlight on hover */
    transform: translateY(-2px);
}


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

.project-card {
    background-color: var(--card-bg-color); /* Use card background */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    padding: 20px;
    text-align: center;
    position: relative;
    z-index: 3; /* Ensure cards are above section bg/overlay */
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.project-card img {
    margin-bottom: 15px;
    border-radius: 4px;
    aspect-ratio: 16 / 10; /* Maintain aspect ratio */
    object-fit: cover; /* Cover the area nicely */
}

.project-card h3 {
    font-size: 1.4rem;
    color: var(--text-color);
    margin-bottom: 10px;
}

.project-card p {
    font-size: 0.95rem;
    color: var(--text-muted-color);
    margin-bottom: 15px;
}

.project-link {
    display: inline-block;
    margin: 5px;
    padding: 5px 15px;
    border: 1px solid var(--primary-color);
    border-radius: 15px;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.project-link:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* --- Certificate Section --- */
.certificate-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 2rem;
}

.certificate-item {
    /* Inherits background from .alt-bg section */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    text-align: center;
    padding: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    z-index: 3; /* Above section bg */
}

.certificate-item img {
    border-radius: 4px;
    margin-bottom: 10px;
    opacity: 0.85;
    transition: opacity 0.3s ease, transform 0.3s ease;
    aspect-ratio: 3 / 2; /* Maintain aspect ratio */
    object-fit: contain; /* Show whole certificate */
}

.certificate-item:hover {
    transform: scale(1.05);
    box-shadow: var(--hover-glow);
    border-color: var(--primary-color);
}

.certificate-item:hover img {
    opacity: 1;
    transform: scale(1.2);
}

.todistus:hover img {
    transform-origin: center 60%;
    opacity: 1;
    transform: scale(2.7);
}
.htb:hover img {
    opacity: 1;
    transform: scale(2.2);
}

.certificate-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0;
}

/* --- Contact Section --- */
.contact-form {
    max-width: 600px;
    margin: 2rem auto 0;
    display: grid;
    gap: 20px;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--secondary-color);
    background-color: var(--bg-color); /* Use base bg */
    color: var(--text-color);
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    z-index: 3; /* Above section overlay */
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(195, 7, 63, 0.5);
}

.contact-form button {
    justify-self: center;
    width: auto;
}

/* --- Footer --- */
.main-footer {
    text-align: center;
    padding: 40px 0 30px;
    background-color: var(--bg-color); /* Solid footer background */
    color: var(--text-muted-color);
    font-size: 0.9rem;
    position: relative;
    z-index: 5; /* Above canvas */
}

.social-links {
    margin-bottom: 25px; /* More space */
}

.social-links a {
    display: inline-block;
    margin: 0 12px; /* Slightly more space between icons */
    transition: transform 0.3s ease, opacity 0.3s ease, color 0.3s ease; /* Add color transition */
    color: var(--text-muted-color); /* Default icon color */
}

.social-links a svg {
    width: 40px; /* Control SVG icon size */
    height: 40px;
    vertical-align: middle;
}

.social-links a:hover {
    transform: scale(1.15);
    opacity: 1; /* Use full opacity on hover */
    color: var(--primary-color); /* Change icon color on hover */
}


/* --- Scroll Animations --- */
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-on-scroll.fade-in { }
.animate-on-scroll.slide-up { transform: translateY(50px); }
.animate-on-scroll.scale-up { transform: scale(0.9); }

.animate-on-scroll.delay-1 { transition-delay: 0.15s; }
.animate-on-scroll.delay-2 { transition-delay: 0.3s; }
.animate-on-scroll.delay-3 { transition-delay: 0.45s; }

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}


/* --- Responsiveness --- */
@media (max-width: 768px) {
    :root { --profile-img-size: 120px; } /* Smaller profile pic on tablets */
    h1 { font-size: 2.8rem; }
    h2 { font-size: 2rem; }
    .main-header nav ul { justify-content: space-around; }
    .main-header nav ul li { margin: 0 5px; }
    .main-header nav ul li a { padding: 5px; font-size: 0.9rem;}

    .project-grid { grid-template-columns: 1fr; }
    .certificate-gallery { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    .content-section { padding: 60px 0; }
    .skills-grid { gap: 10px; }
    .skill-item { padding: 8px 15px; font-size: 0.9rem; }
}

@media (max-width: 480px) {
     :root { --profile-img-size: 100px; } /* Smaller profile pic on mobiles */
    h1 { font-size: 2.2rem; margin-top: 1rem; }
    .hero-content .subtitle { font-size: 1.1rem; }
    .cta-button { padding: 10px 25px; font-size: 0.9rem; }
    .main-header { padding: 10px 0; }
    .main-header nav ul li { margin: 0 2px; } /* Tighter spacing */
    .main-header nav ul li a { font-size: 0.75rem;} /* Smaller nav text */
    .social-links a svg { width: 35px; height: 35px; } /* Slightly smaller icons on mobile */
    .social-links a { margin: 0 8px; }
    .skills-grid { gap: 8px; }
    .skill-item { padding: 6px 12px; font-size: 0.85rem; }
}