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

html {
    font-size: 16px; /* Base font size */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: #f8f8f8; /* Light grey background like screenshot */
    color: #333; /* Default text color */
    line-height: 1.6;
    padding-top: 80px; /* Space for fixed nav */
}

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

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-10px); }
}

/* Top Navigation */
.top-nav {
    position: fixed; /* Fixed at top */
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center; /* Keep nav centered for now */
    padding: 1rem 0; /* Restore original padding */
    background-color: rgba(248, 248, 248, 0.9); /* Semi-transparent background */
    backdrop-filter: blur(5px);
    z-index: 100;
}

.top-nav a {
    text-decoration: none;
    color: #777; /* Lighter grey for inactive nav links */
    padding: 0.5rem 1rem; /* Restore original padding */
    margin: 0 0.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, color 0.2s ease; /* Restore background-color transition */
}

.top-nav a:hover {
    color: #222; /* Darker grey/black on hover */
}

.top-nav a.active {
    background-color: #eee; /* Restore background for active link */
    color: #222; /* Darker text for active link */
}

/* Main container */
.container {
    max-width: 705px; /* Match expanded image cluster with its padding (685px + 2*10px) */
    margin: 2rem auto; 
    padding: 2rem;
    text-align: left; 
    position: relative; 
    left: -18px; /* Shift entire container left further */
}

/* Add fade-out animation for container */
.container.fade-out {
    animation: fadeOut 0.4s ease-in forwards;
}

/* Add fade-in animation for container */
.container.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0; /* Start transparent */
}

/* Image Cluster - Initial State */
.image-cluster {
    position: relative; 
    height: 145px; 
    width: 210px; /* Increased initial width */
    margin-bottom: 1.5rem; 
    margin-left: 0; /* Revert to left alignment */
    margin-right: 0; /* Revert to left alignment */
    cursor: pointer; 
    padding: 5px; 
    border-radius: 8px; 
    transition: background-color 0.4s ease, padding 0.4s ease, width 0.4s ease;
}

.cluster-img {
    position: absolute;
    /* Final size set initially */
    width: 125px; 
    height: 125px; 
    border-radius: 6px; 
    box-shadow: 0 3px 9px rgba(0,0,0,0.18);
    object-fit: cover;
    transform-origin: center center; 
    /* Animate only transform and opacity for performance */
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
                opacity 0.4s ease; 
    will-change: transform, opacity;
    backface-visibility: hidden; 
    opacity: 0.9; 
    /* Set base left/top - these won't animate */
    left: 0; 
    top: 10px; /* Baseline top */
}

/* Initial scale and transform - Increased horizontal spacing */
.cluster-img.img-1 { transform: scale(0.6) rotate(-12deg) translate(-20px, 20px); z-index: 1; }
.cluster-img.img-2 { transform: scale(0.6) rotate(5deg)   translate(40px, 10px);  z-index: 2; }
.cluster-img.img-3 { transform: scale(0.6) rotate(-6deg)  translate(100px, 30px); z-index: 3; }
.cluster-img.img-4 { transform: scale(0.6) rotate(10deg)  translate(160px, 5px); z-index: 4; } /* Moved up (reduced Y translate) */
.cluster-img.img-5 { transform: scale(0.6) rotate(-8deg)  translate(200px, 40px); z-index: 5; } /* Moved down further */

/* Image Cluster - Expanded State */
.image-cluster.expanded {
    background-color: #eee; 
    padding: 10px; 
    width: 685px; /* Adjusted for 5 images: (5*125) + (6*10) = 625 + 60 = 685px */
    height: 145px; 
    /* margin-left: auto; Ensure the expanded cluster is centered */
    /* margin-right: auto; Ensure the expanded cluster is centered */
    /* position: relative; Added for manual adjustment */
    /* left: -15px; Shift left for better visual centering with nav */
}

.image-cluster.expanded .cluster-img {
    /* Final width/height are already set */
    opacity: 1;
    box-shadow: 0 5px 12px rgba(0,0,0,0.18); 
    /* Calculate final transform: translate to position + scale(1) + rotate(0) */
    /* transition and will-change are already set on the base .cluster-img */
}

/* Final positions defined purely by transform - adjusted for 550px total width */
.image-cluster.expanded .cluster-img.img-1 { transform: translate(10px, 0px)  scale(1) rotate(0deg); } 
.image-cluster.expanded .cluster-img.img-2 { transform: translate(145px, 0px) scale(1) rotate(0deg); } /* 10 + 125 + 10 */
.image-cluster.expanded .cluster-img.img-3 { transform: translate(280px, 0px) scale(1) rotate(0deg); } /* 145 + 125 + 10 */
.image-cluster.expanded .cluster-img.img-4 { transform: translate(415px, 0px) scale(1) rotate(0deg); } /* 280 + 125 + 10 */
.image-cluster.expanded .cluster-img.img-5 { transform: translate(550px, 0px) scale(1) rotate(0deg); } /* 415 + 125 + 10 */

/* Name Heading */
.main-name {
    font-size: 1.0rem; /* Reduced size */
    font-weight: 500; /* Standard weight */
    margin-bottom: 0.5rem; /* Reduced spacing */
    color: #111;
    text-align: left; /* Explicitly left */
}

/* Introduction Text */
.intro-text {
    font-size: 0.95rem; /* Slightly smaller */
    color: #999; /* Lighter grey */
    margin-bottom: 1rem; /* Reduced spacing */
    line-height: 1.6; /* Adjusted line height */
    text-align: left; /* Explicitly left */
}

/* Social Icons */
.social-icons {
    display: flex;
    justify-content: flex-start; /* Align icons to the left */
    gap: 1.2rem; /* Adjusted gap */
}

.social-icons a {
    color: #777; /* Default color for Font Awesome icons */
    font-size: 1.19rem; /* Size for Font Awesome icons */
    transition: color 0.2s ease; /* Keep only color transition */
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    line-height: 1; /* Prevent extra line height */
}

.social-icons a:hover {
    color: #222; /* Hover color for Font Awesome */
    text-decoration: none; /* Ensure no underline on hover */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    .container {
        padding: 1.5rem;
        margin-top: 1rem;
    }
    .main-name {
        font-size: 2rem; /* Adjusted */
    }
    .intro-text {
        font-size: 0.9rem; /* Adjusted */
    }
    .social-icons {
        gap: 1rem;
    }
    .social-icons a {
        font-size: 1.2rem; 
    }
    .top-nav a {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
     .main-name {
        font-size: 1.8rem; /* Adjusted */
    }
     .intro-text {
        font-size: 0.85rem; /* Adjusted */
    }
}

/* --- Modal Styles --- */

.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background-color: transparent; /* Explicitly transparent */
}

.modal.modal-active {
    display: flex; /* Show modal */
}

.modal-overlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Dark semi-transparent overlay */
    z-index: 1001;
}

.modal-content {
    position: relative;
    background-color: transparent; /* Ensure transparent */
    margin: auto;
    padding: 0;
    border-radius: 0;
    max-width: 90%;
    max-height: 90%;
    z-index: 1002;
    text-align: center;
    animation: modalFadeIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-close {
    display: none; /* Remove close button */
}

.modal-image {
    display: block;
    max-width: 100%;
    max-height: 75vh; 
    margin: 0 auto 10px auto; 
    border-radius: 6px; /* Increased rounding */
    border: none; /* Explicitly remove border */
    box-shadow: none; /* Explicitly remove shadow */
}

.modal-description {
    font-size: 0.85rem; 
    color: #fff; 
    background-color: rgba(0, 0, 0, 0.4); /* Lighter dark background */
    padding: 6px 12px; 
    border-radius: 4px; 
    margin-bottom: 15px; 
    display: inline-block; 
    max-width: 80%; 
}

/* Container for Nav buttons */
.modal-nav-container {
    display: flex;
    justify-content: center;
    gap: 30px; 
    width: 100%;
    flex-shrink: 0; /* Prevent shrinking/growing unexpectedly */
}

.modal-nav {
    position: static; /* Remove absolute positioning */
    transform: none; /* Remove translateY */
    background-color: transparent; /* No background */
    color: #fff; /* White arrow */
    border: none;
    padding: 5px; /* Minimal padding */
    font-size: 24px; /* Keep for reference, but SVG size is controlled below */
    cursor: pointer;
    border-radius: 0;
    transition: color 0.2s ease; 
    z-index: 1003;
}

.modal-nav:hover {
    background-color: transparent; /* Ensure no background on hover */
    color: #ccc; /* Slightly lighter white on hover */
}

/* Keyframe for fade-in */
@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); } /* Removed scale */
    to { opacity: 1; transform: translateY(0); }
}


/* Ensure links around images don't add extra style */
.cluster-link {
    display: block; /* Make link take up image space */
    line-height: 0; /* Prevent extra space */
    text-decoration: none;
}

/* Optional: Add slight visual cue on image hover */
.cluster-link:hover .cluster-img {
    /* Example: slight brightness change */
     filter: brightness(1.05);
}

.modal-arrow-svg {
    width: 24px; /* Control SVG size */
    height: 24px;
    display: block; /* Ensure proper layout */
}

/* --- Blog Page Styles --- */

/* Increased specificity */
ul.blog-post-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0; /* Add some bottom margin */
}

.blog-post-item {
    border-bottom: 1px solid #f0f0f0; 
}

.blog-post-item:last-child {
    border-bottom: none;
}

/* Re-add link class for specificity */
.blog-post-item a.post-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    padding: 0.75rem 0; /* Add vertical padding to link */
}

/* Re-add hover style for link */
.blog-post-item a.post-link:hover {
    background-color: #f0f0f0; 
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    cursor: pointer; 
    padding: 0 1rem; /* Remove vertical padding, keep horizontal */
    margin-bottom: 0; 
}

.post-title {
    font-weight: 500; 
    font-size: 1.1rem; 
    color: #111 !important; /* Keep override for now */
    margin-right: 1rem; 
}

.post-date {
    font-size: 0.85rem;
    color: #999; 
    flex-shrink: 0; 
}

/* Restore styling for excerpt on list page */
.post-excerpt {
    font-size: 0.95rem;
    color: #555; 
    line-height: 1.5; 
    margin: 0 1rem 0.25rem 1rem; /* Adjust bottom margin for single line */
    /* Single Line Clamping */
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis;
    /* Remove multi-line specific properties */
    /* display: -webkit-box; */ 
    /* -webkit-line-clamp: 1; */
    /* -webkit-box-orient: vertical; */ 
}

/* Remove .post-details hidden/active styles */
/* Remove .post-details p styles */

/* --- Full Blog Post Styles --- */
.blog-post-full {
    margin-bottom: 2rem;
}

.post-full-header {
    border-bottom: 1px solid #eee;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.post-full-title {
    font-size: 1.8rem;
    color: #111;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.post-full-date {
    font-size: 0.9rem;
    color: #777;
    margin: 0;
}

.post-full-content p {
    margin-bottom: 1.25rem;
    line-height: 1.7;
    color: #333;
}

/* Style for back link */
.container > p > a {
    color: #555;
    text-decoration: none;
}
.container > p > a:hover {
    text-decoration: underline;
}

/* --- Work/Projects Page Styles --- */

.page-title {
    font-size: 1.1rem; /* Further reduced size */
    font-weight: 400; /* Normal weight */
    color: #111;
    margin-bottom: 1.8rem; /* Slightly adjusted margin */
    text-align: left;
}

.project-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.project-item {
    padding: 0.5rem 1rem; /* Restore vertical padding */
    border-bottom: 1px solid #f0f0f0; 
    transition: background-color 0.2s ease; /* Only transition background */
    /* Removed display: grid */
    /* Removed grid-template-rows */
    /* Removed row-gap */
}

.project-item:hover {
    background-color: #f0f0f0; 
    border-radius: 6px; 
}

.project-header {
    display: flex; 
    align-items: baseline; 
    padding: 0; /* Remove padding from header */
    cursor: pointer; 
    width: 100%; 
    /* Removed grid-row */
}

.project-item:last-child {
    /* No longer needed as base border is removed */
    /* border-bottom: none; */ 
}

.project-name {
    font-weight: 400; /* Match page title weight (Normal) */
    font-size: 1.1rem; /* Match page title size */
    color: #111;
    flex-shrink: 0; 
    margin-right: 0.75rem;
}

.project-desc {
    font-size: 1rem;
    color: #999; 
    margin-right: 1rem;
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    flex-grow: 1; /* Added to push year to the right */
}

.project-spacer {
    /* Styles commented out or removed */
    display: none; 
}

.project-year {
    font-size: 0.9rem;
    color: #999; 
    flex-shrink: 0; 
    margin-left: 1rem; /* Added left margin for spacing */
}

/* Styles for hidden details section */
.project-details {
    max-height: 0; 
    overflow: hidden; 
    padding: 0 1.5rem; 
    margin-top: 0; 
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.35s cubic-bezier(0.4, 0, 0.2, 1); /* Smoother timing */
    font-size: 0.95rem;
    color: #555;
    line-height: 1.7;
}

/* Styles for expanded state - controlled by JS adding 'active' class */
/* Removed .project-item.active grid rule */

.project-item.active .project-details {
    max-height: 1000px; /* Restore max-height */
    padding-top: 0.8rem; 
    padding-bottom: 1.5rem;
    margin-top: 0.5rem; /* Restore margin-top */
}

.project-details p {
    margin-bottom: 1rem;
}

.project-detail-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.detail-link {
    display: inline-flex; /* Use flex to center icon */
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
    width: 36px; /* Fixed width */
    height: 36px; /* Fixed height (equal to width for square) */
    background-color: #ddd; 
    color: #222; 
    /* Removed padding */
    border-radius: 6px; /* Slightly more rounding */
    text-decoration: none;
    font-size: 1rem; /* Adjust icon size */
    transition: background-color 0.2s ease, color 0.2s ease;
}

.detail-link:hover {
    background-color: #ccc; 
    color: #000; 
}

/* Style for image-based icons within detail links */
.project-detail-img-icon {
    height: 16px; /* Adjust size as needed */
    width: auto;
    display: block; /* Ensure proper layout */
}

/* Responsive adjustments */
@media (max-width: 600px) {
     /* Restore responsive max-height if needed, though 1000px likely enough */
     /* .project-item.active .project-details { max-height: 1000px; } */
     /* Other responsive rules remain */
     .project-header { 
         flex-wrap: wrap;
     }
    .project-desc {
        white-space: normal; 
        width: 100%;
        margin-top: 0.25rem;
        margin-right: 0;
        order: 3; 
    }
    .project-spacer {
        display: none; 
    }
     .project-name {
        flex-grow: 1; 
    }
    .project-year {
       margin-left: 1rem;
       order: 2; 
    }

    /* --- Mobile Image Cluster Adjustments --- */
    .image-cluster {
        /* Center the smaller initial cluster on mobile */
        margin-left: auto;
        margin-right: auto;
        width: 180px; /* Adjust initial size if needed */
        height: 125px;
    }
    /* Reset initial transforms slightly for tighter mobile cluster */
    .cluster-img.img-1 { transform: scale(0.6) rotate(-12deg) translate(0px, 20px); }
    .cluster-img.img-2 { transform: scale(0.6) rotate(5deg)   translate(40px, 10px); }
    .cluster-img.img-3 { transform: scale(0.6) rotate(-6deg)  translate(80px, 30px); }
    .cluster-img.img-4 { transform: scale(0.6) rotate(10deg)  translate(120px, 5px); }

    /* Prevent expansion and horizontal translation on mobile */
    .image-cluster.expanded {
        width: 180px; /* Keep original width */
        background-color: transparent; /* Don't show hover background */
        padding: 5px; /* Keep original padding */
    }
    .image-cluster.expanded .cluster-img {
        /* Just increase opacity/shadow on hover, keep initial transform */
        opacity: 1;
        box-shadow: 0 5px 12px rgba(0,0,0,0.18);
    }
    .image-cluster.expanded .cluster-img.img-1 { transform: scale(0.6) rotate(-12deg) translate(0px, 20px); } 
    .image-cluster.expanded .cluster-img.img-2 { transform: scale(0.6) rotate(5deg)   translate(40px, 10px); } 
    .image-cluster.expanded .cluster-img.img-3 { transform: scale(0.6) rotate(-6deg)  translate(80px, 30px); } 
    .image-cluster.expanded .cluster-img.img-4 { transform: scale(0.6) rotate(10deg)  translate(120px, 5px); } 
} 

/* Specific styles for elements within the post content */
.post-full-content h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #222;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee; /* Subtle separator */
    padding-bottom: 0.3rem;
}

.post-full-content p {
    margin-bottom: 1.2rem;
}

.post-full-content ul,
.post-full-content ol {
    margin-bottom: 1.2rem;
    padding-left: 1.8em; /* More standard indentation */
}

.post-full-content li {
    margin-bottom: 0.5rem;
}

.post-full-content strong {
    font-weight: 600;
    color: #111;
}

.post-full-content a {
    color: #007bff; /* Standard link blue */
    text-decoration: none;
}

.post-full-content a:hover {
    text-decoration: underline;
}

/* Table Styling (moved from inline) */
.post-full-content .comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.8rem 0;
    font-size: 0.9rem;
    border: 1px solid #ddd; /* Add border around table */
}
.post-full-content .comparison-table th,
.post-full-content .comparison-table td {
    border: 1px solid #ddd;
    padding: 10px 12px; /* Slightly more padding */
    text-align: left;
    vertical-align: top;
}
.post-full-content .comparison-table th {
    background-color: #f5f5f5; /* Slightly lighter header */
    font-weight: 600;
    color: #333;
}
.post-full-content .comparison-table tr:nth-child(even) {
    background-color: #fcfcfc; /* Very subtle striping */
}
.post-full-content .comparison-table ul {
    margin: 0;
    padding-left: 1.2em; /* Indent list items inside table */
    list-style-type: disc; /* Ensure bullets are visible */
}
.post-full-content .comparison-table li {
    margin-bottom: 0.4em;
}
.post-full-content .comparison-table strong {
    font-weight: 600;
    color: inherit; /* Inherit color within table */
}


/* Link back to blog list */
.container > p > a[href="/blog"] { /* More specific selector */
    display: inline-block; /* Allows margin */
    color: #555;
    text-decoration: none;
}

.container > p > a[href="/blog"]:hover {
    text-decoration: underline;
} 