:root {
    --primary-color: #0a192f;
    --secondary-color: #172a45;
    --accent-color: #ffd700; /* Gold */
    --text-color: #ccd6f6;
    --light-text-color: #8892b0;
    --font-family: 'Cairo', sans-serif;
    --scroll-padding: 60px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--scroll-padding);
}

body {
    font-family: var(--font-family);
    background-color: var(--primary-color);
    color: var(--text-color);
    text-align: right;
    line-height: 1.6;
}

#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

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

a:hover {
    color: white;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Header & Navbar */
.header {
    background-color: rgba(10, 25, 47, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--secondary-color);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    transition: top 0.3s;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.nav-logo img {
    width: 40px;
    height: 40px;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-size: 1rem;
    color: var(--text-color);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.nav-link:hover {
    color: var(--accent-color);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.hamburger {
    display: none;
    cursor: pointer;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    -webkit-transition: all 0.3s ease-in-out;
    transition: all 0.3s ease-in-out;
    background-color: var(--text-color);
}


/* Hero Section */
.hero-section {
    position: relative; /* Required for canvas positioning */
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 2rem;
    background-image: linear-gradient(rgba(10, 25, 47, 0.85), rgba(10, 25, 47, 0.98)), url('portfolio3.png');
    background-size: cover;
    background-position: center;
    overflow: hidden; /* Keep particles within the hero section */
}

#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-content {
    max-width: 800px;
    position: relative; /* Ensure content is on top of canvas */
    z-index: 2;
}

.hero-content h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: white;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--text-color);
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    background-color: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    padding: 0.75rem 2rem;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: 700;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.cta-button:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

/* General Content Section Styling */
.content-section {
    padding: 5rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-icon-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-icon {
    width: 40px;
    height: 40px;
    opacity: 0;
}

.visible .section-icon {
    animation: fadeInAndFloat 4s ease-in-out infinite;
}

.visible .section-icon-container .section-icon:nth-child(2) {
    animation-delay: 0.2s;
}
.visible .section-icon-container .section-icon:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes fadeInAndFloat {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    12.5% { /* 0.5s / 4s */
        opacity: 1;
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
    100% {
        transform: translateY(0px);
    }
}

.section-title {
    font-size: 2.5rem;
    color: white;
    position: relative;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 80px;
    height: 3px;
    background-color: var(--accent-color);
}

/* Services Section */
.services-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.service-link {
    text-decoration: none;
    color: inherit;
}

.service-card {
    background-color: var(--secondary-color);
    padding: 0;
    border-radius: 8px;
    text-align: center;
    border: 1px solid transparent;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.service-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-color);
    box-shadow: 0 10px 30px -15px rgba(2,12,27,0.7);
}

.service-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.service-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.service-card:hover .service-card-image img {
    transform: scale(1.05);
}

.service-card-content {
    padding: 2.5rem 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}


.service-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem auto;
}

.service-card h3 {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 1rem;
}

.service-card p {
    color: var(--light-text-color);
}

/* Portfolio Section */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.portfolio-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.portfolio-item:hover img {
    transform: scale(1.1);
}

.portfolio-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    color: white;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 1.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.portfolio-item:hover .overlay {
    opacity: 1;
}

/* Contact Section */
.contact-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: right;
    margin-top: 3rem;
    background-color: var(--secondary-color);
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px -15px rgba(2,12,27,0.7);
    border: 1px solid #2c3e5a;
}

@media (min-width: 992px) {
    .contact-container {
        grid-template-columns: 1fr 1.2fr;
        text-align: right;
        padding: 4rem;
    }
}

.contact-info h3 {
    font-size: 1.8rem;
    color: white;
    margin-bottom: 1rem;
}

.contact-info p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--light-text-color);
    margin-bottom: 2rem;
}

.social-media {
    display: flex;
    gap: 1.5rem;
    justify-content: flex-start;
}

.social-media a {
    color: var(--text-color);
    font-size: 1.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-block;
}

.social-media a:hover {
    color: var(--accent-color);
    transform: translateY(-5px);
}

.contact-form .form-group {
    position: relative;
    margin-bottom: 2rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 1rem;
    background-color: var(--secondary-color);
    border: 1px solid #2c3e5a;
    border-radius: 5px;
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 1rem;
    transition: border-color 0.3s ease;
    resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.contact-form label {
    position: absolute;
    right: 1rem;
    top: 1rem;
    padding: 0 0.25rem;
    color: var(--light-text-color);
    pointer-events: none;
    transition: all 0.3s ease;
    background-color: var(--secondary-color);
}

.contact-form input:focus + label,
.contact-form textarea:focus + label,
.contact-form input:not(:placeholder-shown) + label,
.contact-form textarea:not(:placeholder-shown) + label {
    top: -0.75rem;
    font-size: 0.85rem;
    color: var(--accent-color);
}

.contact-form .cta-button {
    width: 100%;
    cursor: pointer;
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    position: relative;
    padding-top: 4rem;
    overflow: hidden;
    border-top: 1px solid var(--secondary-color);
}

.footer-background-animation {
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        115deg,
        var(--primary-color) 25%,
        var(--secondary-color) 50%,
        var(--primary-color) 75%
    );
    background-size: 50% 100%;
    animation: gradient-animation 20s linear infinite;
    z-index: 0;
    opacity: 0.5;
}

@keyframes gradient-animation {
    0% { transform: translateX(0%); }
    100% { transform: translateX(25%); }
}

.footer-container, .footer-bottom {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2.5rem;
    padding-bottom: 3rem;
    text-align: right;
}

.footer-about .nav-logo {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.footer-about p {
    color: var(--light-text-color);
    line-height: 1.8;
}

.footer h4 {
    font-size: 1.25rem;
    color: white;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 2px;
    background-color: var(--accent-color);
}

.footer-links ul li {
    margin-bottom: 0.75rem;
}

.footer-links ul li a {
    color: var(--light-text-color);
}

.footer-links ul li a:hover {
    color: var(--accent-color);
    padding-right: 5px;
}

.footer-social .social-media {
    justify-content: flex-start;
}

.footer-bottom {
    border-top: 1px solid var(--secondary-color);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.9rem;
    color: var(--light-text-color);
}

/* Animation Effects */
.fade-in {
    animation: fadeIn 1s ease-in-out forwards;
}

.hero-content h1 { animation-delay: 0.2s; }
.hero-content p { animation-delay: 0.4s; }
.hero-content .cta-button { animation-delay: 0.6s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.services-container .reveal:nth-child(1) { transition-delay: 0.1s; }
.services-container .reveal:nth-child(2) { transition-delay: 0.2s; }
.services-container .reveal:nth-child(3) { transition-delay: 0.3s; }
.portfolio-grid .reveal:nth-child(1) { transition-delay: 0.1s; }
.portfolio-grid .reveal:nth-child(2) { transition-delay: 0.2s; }
.portfolio-grid .reveal:nth-child(3) { transition-delay: 0.3s; }
.portfolio-grid .reveal:nth-child(4) { transition-delay: 0.4s; }

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        right: -100%;
        top: 60px;
        flex-direction: column;
        background-color: var(--secondary-color);
        width: 100%;
        height: calc(100vh - 60px);
        text-align: center;
        transition: 0.3s;
        gap: 0;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-item {
        margin: 2rem 0;
    }
    
    .nav-link {
        font-size: 1.5rem;
    }

    .hamburger {
        display: block;
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    .content-section {
        padding: 4rem 1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
}