/* Music subdomain styles */

/* ==========================================================================
   CSS Variables & Base Styles
   ========================================================================== */

:root {
    /* Greyscale variations */
    --dark-base: #000000;
    --dark-medium-darkest: #0a0a0a;
    --dark-medium-darker: #141414;
    --dark-medium: #1f1f1f;
    --dark-medium-lighter: #545454;
    --dark-medium-lightest: #878787;
    --dark-medium-lightest-30percent: rgba(84, 84, 84, 0.3);
    --dark-light: #d1d1d1;
    
    /* Accent variations - Lime Green */
    --accent-base: limegreen;
    --accent-hover: #28A728;
    --accent-muted: #90EE90;
    --accent-light: #ADFF2F;
    --accent-dark: #228B22;
    --accent-darker: #1B6B1B;
    --accent-darkest: #0F3F0F;
    
    /* Typography - Responsive Font Scale using clamp() */
    --font-xs: clamp(0.7rem, 0.8vw + 0.6rem, 0.8rem);
    --font-sm: clamp(0.75rem, 0.8vw + 0.65rem, 0.85rem);
    --font-md: clamp(1rem, 1.2vw + 0.8rem, 1.2rem);
    --font-lg: clamp(1.1rem, 1.4vw + 0.8rem, 1.4rem);
    --font-xl: clamp(1.3rem, 1.6vw + 1rem, 1.6rem);
    --font-2xl: clamp(1.5rem, 2vw + 1.2rem, 2rem);
    --font-3xl: clamp(2rem, 2.5vw + 1.5rem, 2.5rem);
    --font-4xl: clamp(2.5rem, 3vw + 2rem, 3rem);
    --font-5xl: clamp(3rem, 4vw + 2.5rem, 4rem);
    
    /* Responsive unified sizing scale */
    --xs: clamp(0.25rem, 0.5vw + 0.25rem, 0.5rem);
    --sm: clamp(0.75rem, 1vw + 0.5rem, 1rem);
    --md: clamp(1rem, 1.5vw + 0.75rem, 1.5rem);
    --lg: clamp(1.5rem, 2vw + 1rem, 2rem);
    --xl: clamp(2rem, 3vw + 1.5rem, 3rem);
    
    /* Responsive line-heights using clamp() */
    --tight: clamp(1.1, 0.1vw + 1.0, 1.2);
    --normal: clamp(1.4, 0.2vw + 1.3, 1.6);
    --relaxed: clamp(1.5, 0.3vw + 1.4, 1.8);
    --loose: clamp(1.7, 0.5vw + 1.7, 2.2);
    
    /* Border radius */
    --radius: 0.5rem;
    --radius-rounded: 50%;
    
    /* Text shadows */
    --text-shadow-layered: 0px 0px 1px rgba(0,0,0,0.4), -1px 1px 2px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.2);
    --text-shadow-layered-small: 0px 0px 1px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--dark-base);
    color: var(--dark-light);
    line-height: var(--normal);
    font-size: var(--font-md);
    min-height: 100vh;
}

/* ==========================================================================
   Layout & Container
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--lg);
    padding-top: var(--lg);
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1 {
    font-size: var(--font-3xl);
    font-weight: 700;
    line-height: var(--tight);
    margin-bottom: var(--lg);
    letter-spacing: -0.03em;
    color: var(--dark-light);
}

h2 {
    font-size: var(--font-2xl);
    font-weight: 700;
    line-height: var(--tight);
    margin-bottom: var(--lg);
    letter-spacing: -0.03em;
    text-align: center;
    color: var(--accent-base);
}

h3 {
    font-size: var(--font-xl);
    font-weight: 700;
    line-height: var(--tight);
    margin-bottom: var(--lg);
    letter-spacing: -0.03em;
    color: var(--dark-light);
}

p {
    margin-bottom: var(--md);
    line-height: var(--relaxed);
}

a {
    color: var(--accent-base);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: none;
}

.back-link {
    color: var(--accent-base);
    text-decoration: none;
    font-weight: 500;
}

.back-link:hover {
    color: var(--accent-hover);
}

/* ==========================================================================
   Edit Link
   ========================================================================== */

.edit-link {
    display: none;
    font-size: var(--font-sm);
    color: var(--dark-light);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: var(--xs) var(--sm);
    border-radius: var(--radius);
    background-color: var(--dark-medium-darkest);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--accent-muted) 20%, transparent);
    line-height: 1;
    vertical-align: middle;
    margin-left: var(--sm);
}

article:hover .edit-link {
    display: inline-block;
}

.edit-link:hover {
    background-color: var(--dark-medium-darker);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent-muted) 30%, transparent);
}

.edit-link:active {
    transform: translateY(0);
}

/* ==========================================================================
   Music-Specific Styles
   ========================================================================== */

.main-content {
    min-height: 60vh;
}

.subtitle {
    font-size: var(--font-lg);
    color: var(--dark-medium-lighter);
    margin-bottom: var(--xl);
}

.coming-soon {
    background: var(--dark-medium-darkest);
    border-radius: var(--radius);
    padding: var(--lg);
    margin-top: var(--lg);
    border: 1px solid var(--dark-medium-lighter);
}

.coming-soon h2 {
    font-size: var(--font-2xl);
    margin-bottom: var(--md);
}

.coming-soon p {
    margin-bottom: var(--lg);
    line-height: var(--relaxed);
}

.implementation-status,
.next-steps {
    margin-top: var(--lg);
    padding-top: var(--lg);
    border-top: 1px solid var(--dark-medium-lighter);
}

.implementation-status h3,
.next-steps h3 {
    font-size: var(--font-xl);
    margin-bottom: var(--md);
}

.implementation-status ul,
.next-steps ol {
    margin-left: var(--lg);
    line-height: var(--relaxed);
}

.implementation-status ul li {
    margin-bottom: var(--sm);
}

.next-steps ol li {
    margin-bottom: var(--sm);
}

/* Prototype cards hover effect */
.prototype-card {
    text-decoration: none;
    transition: transform 0.3s ease;
}

.prototype-card:hover {
    transform: translateY(-4px);
}

.prototype-card:hover > div {
    border-color: var(--accent-hover);
}

/* ==========================================================================
   Thoughts/Posts Section
   ========================================================================== */

.thoughts-grid {
    display: flex;
    flex-direction: column;
    gap: var(--sm);
    margin-bottom: var(--lg);
}

.thought-card-link {
    display: flex;
    gap: var(--md);
    text-decoration: none;
    color: inherit;
}

.thought-card {
    background-color: var(--dark-medium-darker);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    overflow: hidden;
}

.thought-card:hover {
    background-color: var(--dark-medium);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(50, 205, 50, 0.1);
}

.thought-image {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    overflow: hidden;
    background-color: var(--dark-medium-darker);
}

.thought-image img,
.thought-image picture {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.thought-image-placeholder {
    width: 100%;
    height: 100%;
    background-color: var(--dark-medium-darker);
    background-image: url('https://thoughts.encosion.com/images/optimised/1754820088_9d89e1a3.avif');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thought-card:hover .thought-image img,
.thought-card:hover .thought-image picture {
    transform: scale(1.05);
}

.thought-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.thought-title {
    margin: 0 0 var(--xs) 0;
    font-size: var(--font-lg);
    line-height: var(--tight);
    color: var(--dark-light);
    transition: color 0.2s ease;
    font-weight: 700;
}

.thought-card:hover .thought-title {
    color: var(--accent-base);
}

.thought-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--xs);
    margin-top: var(--xs);
}

.thought-date {
    color: var(--dark-medium-lighter);
    font-size: var(--font-xs);
    text-transform: uppercase;
}

.thought-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--xs);
}

.tag {
    background-color: var(--dark-medium-darker);
    color: var(--dark-medium-lightest);
    padding: 2px var(--xs);
    border-radius: calc(var(--radius) / 2);
    font-size: var(--font-xs);
    line-height: 1.4;
}

/* ==========================================================================
   Single Post View
   ========================================================================== */

.single-post {
    max-width: 720px;
    margin: 0 auto;
}

.post-date {
    display: flex;
    align-items: center;
    gap: var(--sm);
    color: var(--dark-medium-lighter);
    font-size: var(--font-sm);
    margin-top: var(--md);
    margin-bottom: var(--md);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-title {
    font-size: var(--font-3xl);
    font-weight: 700;
    line-height: var(--tight);
    margin-bottom: var(--lg);
    letter-spacing: -0.03em;
    color: var(--dark-light);
}

.post-content {
    font-size: var(--font-lg);
    line-height: var(--loose);
    color: var(--dark-light);
}

.post-content strong {
    font-weight: 600;
    color: var(--dark-light);
}

.post-content em {
    font-style: italic;
}

.post-content h3 {
    font-size: var(--font-xl);
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--dark-light);
    margin-top: var(--xl);
    margin-bottom: var(--md);
}

.post-content blockquote {
    border-left: 3px solid var(--accent-base);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--dark-medium-lightest);
}

.post-content code {
    background: var(--dark-medium-darkest);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.post-content pre {
    background: var(--dark-medium-darkest);
    padding: var(--md);
    border-radius: var(--radius);
    overflow-x: auto;
    margin: var(--md) 0;
}

.post-content pre code {
    background: none;
    padding: 0;
    font-size: var(--font-sm);
}

.post-content ul,
.post-content ol {
    margin: var(--md) 0;
    padding-left: var(--xl);
}

.post-content li {
    margin: var(--sm) 0;
    line-height: var(--relaxed);
}

.post-content img,
.post-content picture img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.post-content a {
    color: var(--accent-base);
    text-decoration: none;
}

.post-content a:hover {
    color: var(--accent-hover);
}

/* ==========================================================================
   Media Container
   ========================================================================== */

.media-container {
    margin: 2rem -2rem;
    background-color: var(--dark-medium-darkest);
    padding: 2rem;
    border-radius: var(--radius);
}

.media-container img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    display: block;
    min-width: 300px;
    max-width: 100%;
    object-fit: contain;
}

.media-container audio {
    width: 100%;
}

.media-container iframe {
    width: 100%;
    border: none;
    border-radius: var(--radius);
}

/* Audio embeds */
.audio-embed {
    margin: 0;
    padding: 1.5rem;
    background-color: var(--dark-medium-darkest);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    text-align: center;
}

.audio-embed:hover {
    background-color: var(--dark-medium-darker);
}

.audio-embed iframe {
    border-radius: var(--radius);
    background-color: var(--dark-base);
}

.audio-embed.soundcloud-embed iframe {
    height: 200px;
}

.audio-embed .audio-title {
    font-size: var(--font-sm);
    color: var(--dark-medium-lightest);
    text-align: center;
    font-style: italic;
}

.audio-embed .audio-link {
    text-decoration: none;
    text-align: center;
}

.direct-audio-embed audio {
    width: 100%;
    height: 40px;
    border-radius: var(--radius);
}

/* Image Embeds */
/* 
 * Styling for images processed through Markdown (![alt](image.jpg)).
 * All images automatically get this styling and break out of article bounds
 * for maximum visual impact, especially for high-resolution DSLR photos.
 * 
 * Key Features:
 * - Full-width display breaking out of ~656px article width
 * - Responsive sizing up to 1200px maximum
 * - Consistent background and hover effects
 * - Integration with background blur for low-resolution images
 * 
 * Usage:
 * - Markdown: ![description](image.jpg)
 * - PHP: Automatically wrapped in <div class="image-embed">
 * - CSS: Uses calc(100vw - 8rem) for responsive width
 */
.image-embed {
    background-color: var(--dark-medium-darkest);
    padding: 2rem;
    border-radius: var(--radius);
}

.image-embed:hover {
    background-color: var(--dark-medium-darker);
}

.image-embed img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius);
    transition: opacity 0.3s ease;
    /* Ensure images can display at reasonable size */
    min-width: 300px;
    max-width: 100%;
    /* Ensure aspect ratio is maintained */
    object-fit: contain;
}

/* Responsive picture elements */
.image-embed picture {
    display: block;
    width: 100%;
}

.image-embed picture img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    transition: opacity 0.3s ease;
    background-color: var(--dark-medium-darker);
    /* Ensure images can display at reasonable size */
    min-width: 300px;
    max-width: 100%;
    /* Ensure aspect ratio is maintained */
    object-fit: contain;
}

/* Loading state for images */
.image-embed img[loading="lazy"] {
    background: var(--dark-medium-darker);
}

/* Image fade-in effect when loaded */
.image-embed img.loaded {
    opacity: 1;
}

/* Placeholder for loading images */
.image-embed.loading::before {
    content: "Loading image...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--dark-medium-lighter);
    font-size: var(--font-sm);
    z-index: 1;
    pointer-events: none;
}

/* Image caption styling - similar to audio embed captions */
.image-embed .image-caption {
    color: var(--dark-medium-lightest);
    font-size: var(--font-sm);
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
}

/* Post Content Image Styling */
/* 
 * Images within post content get special treatment to maximize visual impact.
 * High-resolution DSLR images break out of the constrained article width
 * while maintaining text readability.
 * 
 * Layout Strategy:
 * - Text content: Stays within ~656px article bounds for optimal reading
 * - Images: Break out to use maximum available width (up to 1200px)
 * - Responsive: Adapts to different screen sizes with calc(100vw - 8rem)
 */
.post-content .image-embed {
    /* Break out significantly wider than the ~656px article width */
    width: calc(100vw - 8rem);
    max-width: 1200px; /* Reasonable maximum */
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* General Image Constraints */
.post-content img,
.post-content picture img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Gallery Embeds
   ========================================================================== */

.gallery-embed {
    /* Match image-embed styling */
    background-color: var(--dark-medium-darkest);
    padding: 2rem;
    border-radius: var(--radius);
    margin: 2rem 0;
    transition: all 0.2s ease;
}

.gallery-embed:hover {
    background-color: var(--dark-medium-darker);
}

/* For galleries within post content - break out of article bounds like images */
.post-content .gallery-embed {
    /* Break out significantly wider than the ~656px article width */
    width: calc(100vw - 8rem);
    max-width: 1200px; /* Reasonable maximum */
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* Low-Resolution Image Background Blur */
/* 
 * Intelligent background blur system for low-resolution images.
 * Automatically detects small images (< 1024px width, < 100KB) and applies
 * a blurred background effect instead of stretching them.
 */

/* Low-resolution image container with background blur */
.low-res-image-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    background: var(--dark-medium-darker);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 2rem 0;
}

.low-res-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.background-blur {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(5px) brightness(0.5);
}

.low-res-image-container .background-blur {
    transform: scale(1);
}

.foreground-image {
    position: relative;
    z-index: 2;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-title-caption {
    color: var(--dark-medium-lightest);
    font-size: var(--font-sm);
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
}

.gallery-carousel {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
}

.gallery-viewport {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--dark-medium-darker);
}

.gallery-slide {
    display: none;
    position: relative;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-slide.active {
    display: block;
    opacity: 1;
}

.gallery-slide img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    max-height: 85vh;
    object-fit: contain;
}

.gallery-caption {
    color: var(--dark-medium-lightest);
    font-size: var(--font-sm);
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
}

/* Navigation buttons */
.gallery-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 1rem;
    padding: 10px 0;
}

.gallery-nav {
    background-color: var(--dark-medium-darkest);
    color: var(--dark-light);
    border: none;
    border-radius: var(--radius-rounded);
    width: 3.5rem;
    height: 3.5rem;
    font-size: var(--font-2xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    outline: none;
    user-select: none;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent-muted) 30%, transparent);
}

.gallery-nav:hover {
    background-color: var(--dark-medium-darker);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--accent-muted) 40%, transparent);
}

.gallery-nav:active {
    transform: translateY(0);
}

/* Image counter */
.gallery-counter {
    color: var(--dark-medium-lightest);
    font-size: var(--font-sm);
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

.gallery-placeholder {
    padding: 20px;
    text-align: center;
    color: var(--dark-medium-lightest);
    font-style: italic;
    background: var(--dark-medium-darker);
    border-radius: var(--radius);
}

/* Hide navigation for single images */
.gallery-embed:has(.gallery-slide:only-child) .gallery-navigation {
    display: none;
}

/* CSS-Only Gallery Styles */
.css-gallery-viewport {
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    position: relative;
}

.css-gallery-viewport::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.css-gallery-slide {
    flex: 0 0 100% !important;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1 !important;
    position: relative;
}

.css-gallery-slide img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto;
    max-height: 85vh;
    object-fit: contain;
    opacity: 1 !important;
}

/* Invisible scroll buttons overlaid on the image */
.css-gallery-scroll-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 33%;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.css-gallery-scroll-btn:hover {
    opacity: 0.1;
    background: rgba(0, 0, 0, 0.1);
}

.css-gallery-prev {
    left: 0;
}

.css-gallery-next {
    right: 0;
}

.css-gallery .gallery-carousel {
    position: relative;
}

.css-gallery .gallery-counter {
    margin-top: 1rem;
    text-align: center;
}

/* ==========================================================================
   Error Page
   ========================================================================== */

.error-page {
    text-align: center;
    padding: var(--xl);
}

.error-page h1 {
    font-size: var(--font-5xl);
    margin-bottom: var(--md);
    color: var(--accent-base);
}

.error-page p {
    font-size: var(--font-lg);
    margin-bottom: var(--xl);
}

/* ==========================================================================
   Post Tags (from thoughts)
   ========================================================================== */

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sm);
    padding-bottom: var(--xl);
}

.tag-link {
    display: inline-block;
    padding: var(--xs) var(--sm);
    background-color: var(--dark-medium-darker);
    color: var(--dark-light);
    border-radius: calc(var(--radius) / 2);
    font-size: var(--font-sm);
    text-decoration: none;
    transition: all 0.2s ease;
}

.tag-link:hover {
    background-color: var(--accent-base);
    color: var(--dark-base);
    transform: translateY(-1px);
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .container {
        padding: 0;
    }
    
    .main-content {
        padding: var(--md);
    }
    
    .coming-soon {
        padding: var(--md);
    }
    
    .thoughts-section {
        padding: none;
    }

    .thought-image {
        width: 80px;
        height: 80px;
    }
    
    .thought-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .single-post {
        max-width: 100%;
    }
    
    .media-container {
        margin: 2rem -1rem;
        padding: 1rem;
    }
    
    .post-title {
        font-size: var(--font-2xl);
    }
    
    .post-content {
        font-size: var(--font-md);
    }
    
    .post-content .image-embed {
        width: calc(100vw - 2rem);
        padding: 1rem 0;
    }
    
    .post-content .gallery-embed {
        width: calc(100vw - 2rem);
        padding: 1rem 0;
    }
    
    .gallery-nav {
        width: 3rem;
        height: 3rem;
        font-size: var(--font-xl);
    }
}

@media (max-width: 1200px) {
    .post-content .image-embed {
        width: calc(100vw - 4rem);
    }
    
    .post-content .gallery-embed {
        width: calc(100vw - 4rem);
    }
}

