body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f4;
    overflow-x: hidden;
}

/* Header/Banner Styling */
header {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background-color: #2c3e50;
    color: white;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

/* Middle of the page state */
header.centered {
    height: 100vh;
    position: relative;
}

/* Top of the page state (Navbar) */
header.minimized {
    height: auto; /* Allow height to grow on mobile */
    min-height: 80px;
    padding: 10px 0;
    position: sticky;
    top: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.banner {
    text-align: center;
    transition: all 0.6s ease;
    width: 90%;
}

/* Adjust layout when minimized */
header.minimized .banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 auto;
}

/* --- MOBILE SPECIFIC FIXES --- */
@media (max-width: 768px) {
    header.minimized .banner {
        flex-direction: column; /* Stack branding and nav vertically */
        gap: 10px;
    }

    header.minimized .branding {
        text-align: center;
    }

    header.minimized h1 {
        font-size: 1.1rem; /* Shrink title to prevent wrapping */
        white-space: nowrap;
    }

    header.minimized .email {
        display: block !important; /* Force email to stay visible */
        font-size: 0.75rem;
    }

    nav ul {
        gap: 5px; /* Tighten the gap between links */
        justify-content: center;
        flex-wrap: wrap; /* Ensure links wrap if they still don't fit */
    }

    nav a {
        padding: 5px 10px; /* Smaller touch targets for tight spaces */
        font-size: 0.9rem;
    }
}

/* Wrapper for branding to keep Name and Email stacked */
.branding {
    text-align: left;
}

header.centered .branding {
    text-align: center;
    margin-bottom: 20px;
}

header.minimized h1 {
    font-size: 1.2rem;
    margin: 0;
}

header.minimized h1 { font-size: 1.5rem; margin: 0; }

.home-link {
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

header.minimized .email {
    font-size: 0.85rem;
    margin: 2px 0 0 0;
    opacity: 0.8;
}

.reverse-email {
    unicode-bidi: bidi-override;
    direction: rtl;
    cursor: pointer;
}

/* Navigation Links */
nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 20px;
    justify-content: center; /* This ensures links are centered in the Hero/Home state */
}

nav a {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: bold;
    border: 1px solid transparent;
    padding: 8px 16px;
    transition: 0.3s;
}

nav a:hover {
    border: 1px solid #ecf0f1;
    border-radius: 4px;
}

/* Content Sections */
#content {
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    opacity: 1;
    transition: opacity 0.8s ease;
}

.hidden {
    display: none;
    opacity: 0;
}

.content-section {
    padding: 60px 0;
    border-bottom: 1px solid #ddd;
}

.section-subtitle {
    font-style: italic;
    color: #7f8c8d;
    margin-bottom: 40px;
    font-size: 1.1rem;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .services-grid {
        grid-template-columns: 1fr;
    }
}

.service-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-top: 4px solid #2c3e50;
    transition: transform 0.3s ease;
}

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

.service-card h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.25rem;
}

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

.fit-section {
    margin-top: 60px;
    padding: 30px;
    background-color: #ebedef;
    border-radius: 8px;
    border-left: 5px solid #2c3e50;
}

.fit-section h3 {
    margin-top: 0;
    color: #2c3e50;
}

.fit-section p {
    line-height: 1.6;
    color: #34495e;
    margin-bottom: 0;
}

/* Projects & Action Links */
.project-item {
    margin-bottom: 30px;
    padding: 25px;
    border-left: 3px solid #e0e0e0;
    transition: border-color 0.3s ease;
    display: flex;
    gap: 30px;
    background: white;
    border-radius: 0 8px 8px 0;
    align-items: center; /* Centers image vertically relative to text */
}

.project-item:hover {
    border-left-color: #2c3e50;
}

.project-info {
    flex: 1; /* Takes all available space */
}

.project-image {
    flex: 0 0 250px; /* Fixed width, won't grow or shrink */
}

.project-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .project-item {
        flex-direction: column;
        padding: 20px;
    }

    .project-image {
        flex: 0 0 auto;
        width: 100%;
        order: -1; /* Puts image on top on mobile */
    }

    .project-image img {
        height: 200px;
    }
}

.project-item h3 {
    color: #2c3e50;
    margin: 5px 0 10px 0;
    font-size: 1.4rem;
}

.project-tags {
    font-size: 0.75rem;
    color: #34495e;
    background: #ebedef;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-links {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 20px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #2c3e50;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.3s ease;
}

.btn:hover {
    background-color: #34495e;
}

.btn.secondary {
    background-color: transparent;
    color: #2c3e50;
    border: 2px solid #2c3e50;
}

.btn.secondary:hover {
    background-color: #2c3e50;
    color: white;
}

/* About Page Styles */
.profile-header {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.headshot {
    width: 200px;
    height: 200px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.photo-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 40px;
}

.photo-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

@media (max-width: 600px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .photo-gallery {
        grid-template-columns: 1fr;
    }

    .headshot {
        width: 150px;
        height: 150px;
    }
}

/* Modal / Lightbox Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    cursor: zoom-out;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    animation: zoom 0.3s;
}

@keyframes zoom {
    from {transform: scale(0.7); opacity: 0}
    to {transform: scale(1); opacity: 1}
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

#modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 15px 0;
    font-style: italic;
}

.project-image img, .photo-item img {
    cursor: zoom-in;
}