@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');

:root {
    --primary-color: #009486;
    /* Teal from logo */
    --secondary-color: #555555;
    /* Dark Grey from logo */
    --text-color: #555555;
    --bg-color: #fff;
    --light-bg: #f9fdfc;
    --footer-bg: #333;
    --footer-text: #fff;
}

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

html {
    scrollbar-gutter: stable;
}

html,
body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Header & Navbar */
header {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo-link {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 70px;
    /* Adjust height to fit navbar */
    width: auto;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    font-weight: 600;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.mobile-menu-btn svg {
    width: 32px;
    height: 32px;
}

/* Hero Section */
.hero {
    /* Base dark color */
    background-color: #1e1e1e;
    height: 60vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}

/* Background Image with Opacity */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('images/bg.webp') no-repeat center center/cover;
    opacity: 0;
    transition: opacity 0.8s ease-in;
    z-index: 0;
}

/* Fade in background once image is loaded */
.hero.bg-loaded::before {
    opacity: 0.3;
}

/* Code Animation Background */
.code-bg {
    position: absolute;
    top: 0;
    height: 100%;
    width: 25%;
    /* Reduced from 45% to stay on edges */
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    /* Slightly smaller font to fit in narrower column */
    color: rgba(0, 148, 134, 0.9);
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    pointer-events: none;
    user-select: none;
}

.code-bg.left {
    left: 0;
    align-items: flex-start;
    text-align: left;
}

.code-bg.right {
    right: 0;
    left: auto;
    /* explicit override */
    align-items: flex-start;
    /* Keep text left-aligned for readability */
    text-align: left;
    padding-left: 20px;
    /* offset from center */
}

.code-line {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    border-right: 3px solid var(--primary-color);
    /* Thicker cursor */
    width: 0;
    margin-bottom: 5px;
    opacity: 0;
    /* Use 'steps' roughly matching char count for smooth effect */
}

/* Animation delays & specific widths */
/* We need distinct keyframes or a dynamic approach.
   Since CSS vars in keyframes aren't widely supported for 'to' values in all contexts without registration,
   we will just set the width in the specific rules and use a standard animation that fills to 100% of that set width?
   No, that doesn't work. We need specific animations or keyframes.
   
   Simplest robust way: 1 keyframe, but set 'width' on the element to the target, and animate from 0.
   Then after animation, it stays at 24ch.
*/

.code-line:nth-child(1) {
    width: 24ch;
    animation: typeLine 1.5s steps(24, end) both;
    animation-delay: 0s;
}

.code-line:nth-child(2) {
    width: 48ch;
    animation: typeLine 2.5s steps(48, end) both;
    animation-delay: 1.5s;
}

.code-line:nth-child(3) {
    width: 38ch;
    animation: typeLine 2s steps(38, end) both;
    animation-delay: 4.0s;
}

.code-line:nth-child(4) {
    width: 20ch;
    animation: typeLine 1.5s steps(20, end) both;
    animation-delay: 6.0s;
}

.code-line:nth-child(5) {
    width: 20ch;
    animation: typeLine 1.5s steps(20, end) both;
    animation-delay: 7.5s;
}

.code-line:nth-child(6) {
    width: 3ch;
    animation: typeLine 0.5s steps(3, end) both;
    animation-delay: 9.0s;
}

@keyframes typeLine {
    0% {
        width: 0;
        opacity: 1;
        border-right-color: var(--primary-color);
    }

    99% {
        border-right-color: var(--primary-color);
    }

    100% {
        opacity: 1;
        border-right-color: transparent;
    }
}

.hero::after {
    /* Gradient overlay - background for content, but code sits behind or mixed? 
      If Code is z-1 (above image z-0), and Overlay is z-1... 
      Let's use specific indices.
      Image: z-0
      Overlay: z-1
      Code: z-2 (Code floats on top of dark overlay, extremely visible)
      Content: z-3
   */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(30, 30, 30, 0.6) 0%, rgba(30, 30, 30, 0.8) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 800px;
    padding: 20px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 5%;
    }

    .mobile-menu-btn {
        display: block;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        gap: 10px;
        text-align: center;
        width: 100%;
        background-color: #fff;
        position: absolute;
        top: 100%;
        left: 0;
        padding: 20px 0;
        box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    }

    .nav-links.show {
        display: flex;
    }

    .hero {
        height: auto;
        min-height: 80vh;
        /* Allow it to grow if content is long */
        padding: 60px 0;
    }

    .hero-content h1 {
        font-size: 2rem;
        /* Smaller title */
    }

    .hero-content p {
        font-size: 1rem;
    }

    /* Hide complex code animation on very small screens if it distracts, 
       or just adjust it. Let's keep it but make it subtle/smaller. */
    .code-bg {
        font-size: 0.6rem;
        /* Even smaller */
        opacity: 0.3;
        width: 100%;
        /* overlapping is fine at low opacity, or maybe hide one? */
    }

    .code-bg.right {
        display: none;
        /* Hide right side on mobile to reduce clutter */
    }

    .code-line {
        /* Allow wrapping or hide long lines? 
           Code lines are absolute/fixed width in animation. 
           On mobile, 48ch might overflow.
           better to hide overflow or just let it cut off.
        */
        max-width: 100%;
    }

    .container {
        padding: 20px;
    }

    .grid {
        grid-template-columns: 1fr;
        /* Stack cards completely */
    }
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #009486;
}

/* Main Content Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1;
}

section {
    margin-bottom: 60px;
}

section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
    color: var(--primary-color);
}

/* Card Grid (for Services/About snippets) */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.card {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 148, 134, 0.08);
    border-radius: 14px;
    padding: 10px;
    transition: background-color 0.3s, transform 0.3s;
}

.card:hover .card-icon {
    background-color: rgba(0, 148, 134, 0.15);
    transform: translateY(-2px);
}

.card-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.card h3 {
    margin-bottom: 15px;
    color: var(--text-color);
}

/* Footer */
footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

/* Technologies Section */
.technologies {
    text-align: center;
}

.section-desc {
    max-width: 700px;
    margin: 0 auto 40px;
    color: #666;
    font-size: 1.1rem;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    justify-content: center;
}

.tech-card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    /* Softer initial shadow */
    border: 1px solid #eee;
    /* Light border for definition */
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: row;
    /* Horizontal layout */
    align-items: center;
    text-align: left;
    /* Reset center */
    height: auto;
    /* Let content dictate height, usually fixed enough */
}

.tech-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
    /* Highlight border on hover */
}

.tech-card i {
    font-size: 3.5rem;
    /* Larger icon */
    margin-bottom: 0;
    /* Remove bottom margin */
    margin-right: 20px;
    /* Add right margin */
    color: var(--primary-color);
    flex-shrink: 0;
    /* Prevent icon from shrinking */
    width: 60px;
    /* Fixed width area for icon alignment */
    text-align: center;
}

.tech-icon-svg {
    width: 60px;
    height: 60px;
    margin-right: 20px;
    color: var(--primary-color);
    flex-shrink: 0;
    display: block;
}

.tech-info {
    flex: 1;
}

.tech-card h4 {
    margin-bottom: 5px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
}

.tech-card p {
    font-size: 0.95rem;
    color: #666;
    margin: 0;
    line-height: 1.4;
}
/* Clients & Projects Section */
.clients {
    text-align: center;
    margin-top: 80px;
}

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.client-card {
    background: #fff;
    padding: 35px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 148, 134, 0.1);
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.client-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary-color);
    opacity: 0.5;
    transition: opacity 0.3s;
}

.client-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.client-card:hover::before {
    opacity: 1;
}

.client-card h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.client-card p {
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
}

.client-card .project-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-color);
    background: rgba(0, 148, 134, 0.1);
    padding: 4px 12px;
    border-radius: 50px;
    margin-bottom: 15px;
}

.client-card.large {
    grid-column: span 1;
}

@media (min-width: 992px) {
    .client-card.large {
        grid-column: span 2;
    }
}

.client-details {
    margin-top: 10px;
}

.client-details ul {
    margin-top: 15px;
    list-style: none;
    padding-left: 0;
}

.client-details li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: #666;
}

.client-details li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

@media (max-width: 768px) {
    .client-grid {
        grid-template-columns: 1fr;
    }
    
    .client-card.large {
        grid-column: span 1;
    }
}
