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

:root {
    --primary-color: #39ff14;
    --secondary-color: #888888;
    --background: #000000;
    --surface: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border: #333333;
    --draft-color: #ffaa00;
    --wip-color: #ff00ff;
    --success-color: #39ff14;
    --spacing: 1rem;
    --radius: 0.5rem;
    --shadow: 0 1px 3px rgba(57, 255, 20, 0.2), 0 1px 2px rgba(57, 255, 20, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(57, 255, 20, 0.3), 0 4px 6px -2px rgba(57, 255, 20, 0.2);
}

body {
    font-family: 'fixedsys', 'Courier New', 'Courier', monospace;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: never;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--spacing);
}

/* Header */
header {
    background: var(--background);
    border-bottom: 2px solid var(--primary-color);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

header h1 a {
    color: var(--primary-color);
    text-decoration: none;
}

header h1 a:hover {
    opacity: 0.8;
}

header .tagline {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Controls */
.controls {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-sort-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.sort-btn {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-family: 'fixedsys', 'Courier New', 'Courier', monospace;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.sort-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.search-box {
    flex: 1;
    min-width: 0;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: 'fixedsys', 'Courier New', 'Courier', monospace;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.filters label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

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

.track-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.track-card:hover {
    transform: translateY(-2px);
}

.track-card.hidden {
    display: none;
}

.track-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.track-cover {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    background: var(--border);
    overflow: hidden;
}

.track-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 0.25rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
}

.badge-draft {
    background: var(--draft-color);
}

.badge-wip {
    background: var(--wip-color);
}

.track-info {
    padding: 1rem;
}

.track-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.track-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.track-meta span + span::before {
    content: " • ";
}

.track-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    background: var(--border);
    color: var(--text-secondary);
    border-radius: 0.25rem;
}

/* Track Detail Page */
.track-detail {
    max-width: 900px;
    margin: 0 auto;
}

.track-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.track-cover-large img {
    width: 100%;
    border-radius: var(--radius);
}

/* Image Carousel */
.carousel {
    position: relative;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
}

.carousel-images {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 aspect ratio */
}

.carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.carousel-image.active {
    opacity: 1;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-prev {
    left: 0;
}

.carousel-next {
    right: 0;
}

.carousel-dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid white;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

.carousel-dot.active {
    background: white;
}

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

.lightbox.active {
    opacity: 1;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    z-index: 10001;
    line-height: 1;
    padding: 0.5rem;
    transition: opacity 0.2s;
}

.lightbox-close:hover {
    opacity: 0.7;
}

.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    cursor: zoom-out;
}

.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 3rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10001;
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

/* Make images clickable */
.track-cover-large img,
.carousel-image {
    cursor: pointer;
}

.track-metadata h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.meta-value {
    font-size: 1rem;
    color: var(--text-primary);
}

.status-draft {
    color: var(--draft-color);
}

.status-work-in-progress {
    color: var(--wip-color);
}

.status-final {
    color: var(--success-color);
}

/* Audio Player */
.audio-player {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.audio-player h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.audio-player audio {
    width: 100%;
    margin-bottom: 1rem;
}

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

/* Track Content */
.track-content {
    margin-bottom: 2rem;
    line-height: 1.8;
}

.track-content h2 {
    font-size: 1.75rem;
    font-weight: bold;
    margin: 2rem 0 1rem;
    color: var(--primary-color);
}

.track-content h3 {
    font-size: 1.25rem;
    font-weight: bold;
    margin: 1.5rem 0 0.75rem;
    color: var(--primary-color);
}

.track-content p {
    margin-bottom: 1rem;
}

.track-content ul,
.track-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.track-content code {
    background: var(--surface);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.875em;
}

.track-content pre {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1rem;
}

.track-content pre code {
    background: none;
    padding: 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius);
    transition: background-color 0.2s, transform 0.1s;
    cursor: pointer;
    border: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--background);
    font-weight: bold;
}

.btn-primary:hover {
    background: #2bcc10;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--border);
    border-color: var(--primary-color);
}

/* Track Navigation */
.track-navigation {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 2px solid var(--primary-color);
    color: var(--text-secondary);
    text-align: center;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

footer a:hover {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .track-header {
        grid-template-columns: 1fr;
    }

    .track-metadata h1 {
        font-size: 2rem;
    }

    .meta-grid {
        grid-template-columns: 1fr;
    }

    .track-grid {
        grid-template-columns: 1fr;
    }

    .download-links {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .track-metadata h1 {
        font-size: 1.75rem;
    }
}
