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

:root {
    --primary-color: #c500c9;
    --secondary-color: #ffffff;
    --accent-color: #e74c3c;
    --bg-color: #ffffff;
    --about-bg-color: #ffffff;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 12px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

html {
    scroll-behavior: smooth;
}

header {
    background: var(--secondary-color);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 4px 6px color-mix(in srgb, var(--primary-color) 30%, transparent);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-right: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    cursor: pointer;
}

.header-name:hover {
    opacity: 0.8;
}

.header-name.visible {
    opacity: 1;
}

.header-name.visible:hover {
    opacity: 0.8;
}

.header-profile-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 2px solid var(--primary-color);
}

nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: var(--primary-color);
    background: transparent;
    border: 2px solid var(--primary-color);
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.nav-link:hover {
    background: var(--primary-color);
    color: white;
}

.contact-btn {
    color: var(--primary-color);
    background: transparent;
    border: 2px solid var(--primary-color);
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.contact-btn:hover {
    background: var(--primary-color);
    color: white;
}

.admin-link-small {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.admin-link-small:hover {
    opacity: 1;
}

/* About Section */
.about-section {
    background: var(--about-bg-color);
    padding: 4rem 2rem;
    min-height: 400px;
}

.about-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3rem;
    text-align: left;
}

.about-image {
    position: relative;
    flex-shrink: 0;
}

.about-image img {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 2px solid var(--primary-color);
    box-shadow: var(--shadow-hover);
    display: block;
}

.about-content h2 {
    display: none;
}

.about-content .highlight {
    color: var(--primary-color);
    font-weight: 700;
}

.about-content p {
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--text-color);
    font-weight: 400;
}

/* Portfolio Section */
.portfolio-section {
    background: var(--bg-color);
    padding: 3rem 0 4rem 0;
    scroll-margin-top: 80px;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 0;
    padding-bottom: 1rem;
    color: var(--primary-color);
}

.portfolio-section main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 2rem 2rem;
}

/* Contact Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--text-color);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.modal-content input:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.submit-btn:hover {
    background: #a000a5;
}

.contact-status {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

/* Gallery Grid - CSS Grid Layout (strict ordering) */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem 0;
    align-items: start;
}

.gallery-item {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: box-shadow 0.3s ease;
}

.gallery-item:hover {
    box-shadow: var(--shadow-hover);
}

.gallery-item-media {
    width: 100%;
    height: auto;
    display: block;
    background: #f5f5f5;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-item-media {
    transform: scale(1.05);
}

@media (max-width: 1000px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.gallery-item-description {
    padding: 1rem;
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Album Grid Display */
.album-grid-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 2px;
    width: 100%;
    background: #fff;
    overflow: hidden;
}

.album-grid-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover .album-grid-image {
    transform: scale(1.05);
}

/* Fullscreen Viewer */
.viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

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

.viewer-content {
    max-width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
}

.viewer-media[style*="display: none"] {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.viewer-media {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--border-radius);
}

.viewer-description {
    color: white;
    font-size: 1.1rem;
    text-align: center;
    max-width: 800px;
    margin: 0;
    padding: 0.5rem;
    flex-shrink: 0;
}

.viewer-album-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    width: min(70vw, calc(80vh - 4rem));
    height: min(70vw, calc(80vh - 4rem));
    margin: 0 auto;
}

.viewer-album-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    min-height: 0;
    min-width: 0;
}

.close-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: transparent;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.prev-btn {
    left: 2rem;
}

.next-btn {
    right: 2rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 4rem;
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 900px) {
    .about-section {
        padding: 2rem 1rem;
    }

    .about-container {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }

    .about-content p {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    header {
        padding: 0.5rem 1rem;
    }

    .header-content {
        min-height: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .header-name {
        font-size: 1.1rem;
        gap: 0.5rem;
        white-space: nowrap;
    }

    .header-profile-image {
        width: 32px;
        height: 32px;
        border: 2px solid var(--primary-color);
    }

    nav {
        gap: 0.5rem;
        width: 100%;
        justify-content: flex-start;
    }

    .nav-link {
        padding: 0.4rem 0.9rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .contact-btn {
        padding: 0.4rem 0.9rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .admin-link-small {
        display: none;
    }

    .about-image img {
        width: 200px;
        height: 200px;
    }

    .section-title {
        font-size: 2rem;
    }

    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }

    .prev-btn {
        left: 1rem;
    }

    .next-btn {
        right: 1rem;
    }

    .close-btn {
        top: 1rem;
        right: 1rem;
        font-size: 2.5rem;
    }
}

/* Performance optimizations for mobile/touch devices */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover transforms on touch devices - they cause jank */
    .gallery-item:hover .gallery-item-media,
    .gallery-item:hover .album-grid-image {
        transform: none;
    }

    .gallery-item-media,
    .album-grid-image {
        transition: none;
    }

    .gallery-item {
        transition: none;
    }

    /* Disable smooth scrolling on mobile for better performance */
    html {
        scroll-behavior: auto;
    }
}

/* GPU acceleration hints for images */
.gallery-item-media,
.album-grid-image {
    will-change: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Optimize image rendering */
.gallery-item img,
.album-grid-display img {
    image-rendering: -webkit-optimize-contrast;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}
