@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Montserrat:wght@700&display=swap');

:root {
    --bg-color: #121212;
    --primary-color: #1a1a1a;
    --secondary-color: #242424;
    --accent-color: #00bcd4;
    --accent-hover: #00e5ff;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --header-height: 70px;
    --footer-height: 81px; /* Approximate height for calculations */
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.7;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

main {
    flex-grow: 1;
    padding-top: var(--header-height);
    position: relative;
    width: 100%;
}

/* --- Page Transitions --- */
.page-content {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.page-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* --- Header & Navigation --- */
header {
    background-color: rgba(18, 18, 18, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0 25px;
    box-shadow: 0 4px 20px var(--shadow-color);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
    display: flex;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
}

.logo {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 25px;
}

nav ul li a {
    color: var(--text-muted);
    text-decoration: none !important;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    position: relative;
    padding: 5px 0;
}

nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

nav ul li a:hover,
.nav-link.active {
    color: #fff;
}

/* Clear the underline effect for social icons */
nav ul li a:has(img)::after {
    display: none;
}

.nav-link.active::after,
nav ul li a:not(:has(img)):hover::after {
    width: 100%;
}


nav ul li a img {
    height: 18px;
    width: auto;
    filter: grayscale(100%) brightness(1.5);
    transition: filter 0.3s ease, transform 0.3s ease;
}

nav ul li a:hover img {
    filter: grayscale(0%) brightness(1);
    transform: scale(1.1);
}

/* --- Home Page Specifics (Condensed) --- */
#hero {
    min-height: auto;
    padding: 15px 20px 10vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#hero h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    margin: 0;
    color: #fff;
    line-height: 1.1;
}

#hero p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-muted);
    max-width: 600px;
}

#about {
    max-width: 800px;
    margin: 0 auto 60px;
    padding: 40px;
    text-align: center;
    background: var(--primary-color);
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.profile-picture {
    border-radius: 50%;
    width: 180px;
    height: 180px;
    object-fit: cover;
    margin: 30px auto 0;
    border: 5px solid var(--accent-color);
    box-shadow: 0 0 20px rgba(0, 188, 212, 0.4);
}

/* --- Portfolio Page --- */

/* This centers the pill container */
.filter-wrapper {
    display: flex;
    justify-content: center;
    padding: 15px 0;
}

/* The pill container no longer needs margin and fits its content */
#filter-buttons {
    display: none; /* Hide by default */
    gap: 15px;
    background: var(--primary-color);
    padding: 8px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    justify-content: center; /* This centers the buttons inside */
    margin: 0;
    width: fit-content;
}


/* Show filter buttons only when on the portfolio page */
body.portfolio-page #filter-buttons {
    display: flex;
}

/* Increased font size and padding for larger buttons */
.filter-btn {
    background-color: transparent;
    border: none;
    border-radius: 20px;
    padding: 10px 25px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s ease;
    position: relative;
    font-size: 1.25rem;
}

.filter-btn.active {
    color: #fff;
    background-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-color), 0 0 25px var(--accent-color);
}

#portfolio .portfolio-content-area {
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px 20px 20px;
}

.portfolio-section-title {
    display: none; /* This hides the titles */
    margin: 0;
    padding: 0;
}

/* --- Portfolio Items & Grids --- */
.portfolio-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, border-color 0.3s ease;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    overflow: hidden;
    background-color: var(--secondary-color);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.portfolio-item.revealed, .photography-grid-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-item:hover, .photography-grid-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px var(--shadow-color);
}

/* Added a specific hover rule for the image border */
.photography-grid-item:hover img {
    border-color: var(--accent-color);
}


.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

/* --- Photography Grid (Masonry with CSS Grid) --- */
.photography-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(auto-fill, minmax(250px,1fr));
    grid-auto-rows: 1px;
}

.photography-grid-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    overflow: hidden; /* Keep for safety */
}

.photography-grid-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px; /* Match the old container radius */
    border: 2px solid var(--border-color);
    transition: border-color 0.3s ease; /* Add transition for hover effect */
}


/* --- Video Thumbnail Fixes --- */
.video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background-color: #000;
    overflow: hidden;
    border-radius: 10px; /* Apply border-radius to the video thumbnail container */
}

.video-thumbnail > img, .video-thumbnail > video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: none;
    z-index: 1; 
    border-radius: 10px; /* Apply border-radius directly to the image/video within thumbnail */
}

.hosted-hover-preview, .youtube-hover-preview {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: none;
    z-index: 2;
    pointer-events: none;
    border-radius: 10px; /* Apply border-radius to the hover preview */
}

.youtube-hover-preview iframe {
    width: 100%;
    height: 100%;
    border-radius: 10px; /* Apply border-radius to the iframe */
}

.portfolio-item:hover .hosted-static-thumbnail,
.portfolio-item:hover .video-thumbnail > img {
    opacity: 0;
}

.portfolio-item:hover .hosted-hover-preview,
.portfolio-item:hover .youtube-hover-preview {
    opacity: 1;
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 95vw;
    max-height: 95vh;
    overflow: hidden;
}

.media-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Sizing for image media in modal */
.image-wrapper {
    /* REMOVED size constraints from the wrapper */
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
}

.image-wrapper img {
    /* ADDED size constraints directly to the image */
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}


/* --- Unified Video Player Sizing --- */
.yt-player-wrapper,
.hosted-video-wrapper {
    position: relative;
    width: 90vw;
    max-width: 1600px;
    aspect-ratio: 16 / 9;
    max-height: 90vh;
}

.yt-player-wrapper iframe,
.hosted-video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 8px;
}

/* --- Modal Navigation and Close Button Styling --- */
.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    width: 10px;
    height: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: text-shadow 0.3s ease;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.close-modal-btn:hover {
    text-shadow: 0 0 15px rgba(0, 0, 0, 1);
}

.prev, .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 30px;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    padding: 10px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    transition: text-shadow 0.3s ease;
    user-select: none;
}

.prev:hover, .next:hover {
    text-shadow: 0 0 15px rgba(0, 0, 0, 1);
}

.prev {
    left: -10px;
}

.next {
    right: -10px;
}

/* Hide arrows for video content */
.modal:not(.photography-active) .prev,
.modal:not(.photography-active) .next {
    display: none;
}


/* --- Contact Page --- */
#contact .contact-section {
    max-width: 700px;
    margin: 60px auto;
    padding: 40px;
    background: var(--primary-color);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    background-color: var(--secondary-color);
    color: var(--text-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.3);
}

.form-group input[type="submit"] {
    background-color: var(--accent-color);
    color: #000;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.form-group input[type="submit"]:hover {
    background-color: var(--accent-hover);
}

.popup-message {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 2000;
    font-size: 1.2rem;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    text-align: center;
}
.popup-message.show {
    opacity: 1;
    display: block;
}


/* --- Footer --- */
footer {
    text-align: center;
    padding: 30px;
    background-color: var(--primary-color);
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .photography-grid {
       grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
    }
}

/* Desktop Centering for Contact Form */
@media (min-width: 821px) {
    /* This container's only job is to take up space to push the footer down. */
    #contact.page-content.active {
        min-height: calc(100vh - var(--header-height) - var(--footer-height));
    }
    
    /* This takes the form itself and fixes it to the dead center of the screen. */
    #contact.page-content.active .contact-section {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        margin: 0; 
    }
}

@media (max-width: 820px) {
    body {
        padding-top: 0;
    }
    header {
        position: static;
        height: auto;
        padding: 15px;
        backdrop-filter: none;
    }
    main {
        padding-top: 0;
    }
    nav {
        flex-direction: column;
        gap: 15px;
    }
    /* FIX: Reorder nav items on mobile */
    nav .logo { order: 1; }
    nav ul { order: 2; }
    nav #filter-buttons { order: 3; }

    #contact .contact-section {
        margin: 20px auto;
    }

    .photography-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
    }

    .media-container {
        width: 100%; /* Take full width on mobile */
    }

    /* This ensures the pill doesn't touch the screen edges on mobile */
    .filter-wrapper {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* This reduces the space between the buttons on mobile */
    #filter-buttons {
        gap: 5px;
    }
}

@media (max-width: 640px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .photography-grid {
       grid-template-columns: repeat(auto-fill, minmax(150px,1fr));
    }
}