/*
Theme Name: LeonM
Theme URI: https://leonmaddison.com
Author: Leon Maddison
Author URI: https://leonmaddison.com
Description: A minimal media grid theme for displaying images and videos
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: leonm
*/

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Header */
.site-header {
    background: #fff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    text-decoration: none;
}

.submit-button {
    background: #0073aa;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.submit-button:hover {
    background: #005177;
}

/* Main Content */
.site-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Media Filters */
.media-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #666;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: #0073aa;
    color: #0073aa;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,115,170,0.2);
}

.filter-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.filter-btn svg {
    width: 16px;
    height: 16px;
}

/* Media Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.media-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
}

.media-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.media-type-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 0.5rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.media-type-badge svg {
    width: 16px;
    height: 16px;
}

.media-item-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
    pointer-events: none; /* Ensure entire card is clickable */
}

.media-item-video {
    width: 100%;
    height: 300px;
    object-fit: cover;
    pointer-events: none; /* Prevent clicking on video/iframe in grid */
}

.media-item-title {
    padding: 1rem;
    font-size: 0.9rem;
    color: #666;
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 2rem;
    display: none;
}

.loading-indicator.active {
    display: block;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tablet */
@media (max-width: 768px) {
    .media-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .site-main {
        padding: 1rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .media-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .site-header {
        padding: 1rem;
    }

    .site-title {
        font-size: 1.2rem;
    }
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-video {
    width: 90vw;
    max-width: 1200px;
    height: auto;
    aspect-ratio: 16/9;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-video video,
.lightbox-video iframe {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    line-height: 1;
}

.lightbox-close:hover {
    transform: scale(1.2);
}

.lightbox-title {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    color: #fff;
    text-align: center;
    font-size: 1.2rem;
    padding: 1rem;
}

/* Mobile lightbox adjustments */
@media (max-width: 768px) {
    .lightbox-content {
        max-width: 95%;
        max-height: 95%;
    }

    .lightbox-close {
        top: -40px;
        font-size: 2rem;
        width: 40px;
        height: 40px;
    }

    .lightbox-title {
        font-size: 1rem;
        bottom: -50px;
    }

    .lightbox-video {
        width: 95vw;
    }
}

