/**
 * PHP-based Image Gallery Website - Stylesheet
 * 
 * Version: 2026.03.30.13.38.00
 * Description: Main stylesheet using CSS variables for high customizability.
 */

:root {
    /* These variables are overridden in header.php from config.php */
    --bg-color: #002B36;
    /* default */
    --surface-color: #073642;
    /* default */
    /* --border-color: #586E75; */
    --border-color: #002B36;
    /* default */
    --text-dim: #657B83;
    /* default */
    --accent-color: #839496;
    /* default */

    --thumb-size: 300px;
    /* from config */
    --thumb-padding: 10px;
    /* from config */
    --grid-cols: 3;
    /* from config */
    --grid-gap: 20px;
    /* from config */

    --transition-speed: 0.3s;
    --border-radius: 12px;
    --max-width: 1200px;
}

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

body {
    background-color: var(--bg-color);
    color: var(--accent-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Rule #9: Center the overall code output on the canvas */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

header,
footer {
    width: 100%;
    background-color: var(--surface-color);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

footer {
    border-top: 1px solid var(--border-color);
    border-bottom: none;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-social {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.footer-social a {
    color: var(--accent-color);
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-social a:hover {
    color: #fff;
    transform: translateY(-3px);
}

.footer-social [data-lucide] {
    width: 24px;
    height: 24px;
}

.profile-icon {
    width: var(--profile-icon-size, 50px);
    height: var(--profile-icon-size, 50px);
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
    transition: transform var(--transition-speed);
    flex-shrink: 0;
}

.logo h1 a:hover .profile-icon {
    transform: scale(1.05);
}

.site-title-link {
    text-decoration: none !important;
    border: none !important;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 15px;
}

.site-title-link * {
    text-decoration: none !important;
}

.site-title-link span {
    line-height: 1; /* Eliminates tall line-height pushing text off-center from the icon */
    padding-top: 2px; /* Micro-adjustment to optically center with the avatar */
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-speed);
}

nav a:hover {
    color: #fff;
}

h1 {
    font-size: 2rem;
    background: linear-gradient(45deg, var(--accent-color), #fff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Grid View */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), 1fr);
    gap: var(--grid-gap);
    width: 100%;
    margin-top: 2rem;
}

/* Gallery Index Grid */
.galleries-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--grid-gap);
    justify-content: center;
    margin-top: 2rem;
}

.gallery-index-card {
    background-color: var(--bg-color); /* Match page background, kept independent to easily change mind */
    border-radius: var(--border-radius);
    overflow: hidden;
    padding: var(--thumb-padding);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-index-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.thumb-wrapper {
    position: relative;
    width: var(--gallery-thumb-width);
    height: var(--gallery-thumb-height);
    margin-bottom: 1rem;
    border-radius: calc(var(--border-radius) - var(--thumb-padding));
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    overflow: hidden;
}

.thumb-wrapper img,
.thumb-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-color: transparent;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.gallery-index-card h3 {
    color: var(--text-color);
    font-size: 1.2rem;
    margin: 0;
    text-align: center;
}

.gallery-card {
    background-color: var(--bg-color); /* Match page background, kept independent to easily change mind */
    border-radius: var(--border-radius);
    overflow: hidden;
    padding: var(--thumb-padding);
    border: none;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    text-decoration: none;
    color: inherit;
    display: block;
    aspect-ratio: 1 / 1;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.gallery-card img,
.gallery-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: calc(var(--border-radius) - var(--thumb-padding));
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-color: transparent;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.gallery-card-info {
    padding: 1rem;
}

.gallery-card-info h3 {
    margin-bottom: 0.5rem;
    color: #fff;
}

.gallery-card-info p {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.gallery-footer-text a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-speed);
}

.gallery-footer-text a:hover {
    color: #fff;
}

/* Detail View */
.detail-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    animation: fadeIn 0.5s ease;
}

.detail-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    width: 100%;
    flex: 1;
    min-height: 0;
    position: relative;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.4);
    color: #fff;
    text-decoration: none;
    width: 60px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
    opacity: 0;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.detail-image-wrapper:hover .nav-btn {
    opacity: 1;
}

.prev-btn {
    left: 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.next-btn {
    right: 0;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.nav-btn i {
    width: 40px;
    height: 40px;
}

.nav-btn:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

.detail-image-wrapper {
    position: relative;
    max-width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.detail-image {
    max-width: 100%;
    max-height: calc(100vh - 250px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.close-box {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-decoration: none;
    transition: all var(--transition-speed);
}

.close-box:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
    transform: scale(1.1);
}

.close-box i {
    width: 24px;
    height: 24px;
}

.detail-info {
    text-align: center;
}

.detail-info h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #fff;
}

.detail-info p {
    font-size: 1.2rem;
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.back-button {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: var(--accent-color);
    color: var(--bg-color);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 700;
    transition: filter var(--transition-speed);
}

.back-button:hover {
    filter: brightness(1.2);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-view {
    height: calc(100vh - 200px);
    overflow: hidden;
}

.detail-image {
    max-width: 95vw;
    max-height: calc(100vh - 250px) !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .logo h1 {
        font-size: 0.9rem; /* Reduced from 1.1rem to prevent wrapping issues */
        text-align: center;
        white-space: normal; /* Allowed natural wrap as requested */
    }

    .site-title-link {
        justify-content: center;
        gap: 8px;
    }

    .profile-icon {
        width: 35px; /* Reduced from 50px */
        height: 35px; /* Reduced from 50px */
    }

    .gallery-grid {
        /* Increased min-width from 140px to 170px to prevent thumbnails being too small */
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 0.75rem; /* Reduced from 1rem to save space */
    }
    
    .gallery-card {
        padding: 5px; /* Reduced from var(--thumb-padding) (10px) for mobile */
    }
    
    .gallery-index-card {
        width: 100%;
        max-width: 320px;
    }

    .thumb-wrapper {
        width: 100%;
        height: auto;
        aspect-ratio: 9 / 16;
    }
}