/* ==========================================================================
   ZINSTREL AI MUSIC DISPATCHES // SCENE INTELLIGENCE RAIL & READER MODAL
   FreeMusiers Design System: Dark Glass, Neon Coral & Cyan, Space Grotesk
   ========================================================================== */

/* --- Rail Container --- */
.zinstrel-rail {
    margin-top: 32px;
    position: relative;
    z-index: 2;
}

.zinstrel-rail .rail-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed rgba(var(--accent-dim-rgb, 255, 77, 109), 0.4);
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.zinstrel-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.zinstrel-rail-title {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 1px;
    font-family: var(--font-heading, 'Space Grotesk', sans-serif);
    font-weight: 700;
    color: var(--terminal-green, #ff4d6d);
    text-shadow: 0 0 12px rgba(var(--accent-rgb, 255, 77, 109), 0.3);
}

.zinstrel-badge {
    font-size: 0.65rem;
    font-family: var(--font-mono, 'Space Mono', monospace);
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid rgba(0, 240, 255, 0.4);
    color: #00f0ff;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

.zinstrel-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zinstrel-substack-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-family: var(--font-mono, 'Space Mono', monospace);
    font-weight: 600;
    color: #ffffff;
    background: rgba(255, 77, 109, 0.14);
    border: 1px solid rgba(255, 77, 109, 0.45);
    padding: 4px 9px;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.zinstrel-substack-link:hover {
    background: var(--terminal-green, #ff4d6d);
    color: #000000 !important;
    box-shadow: 0 0 12px rgba(255, 77, 109, 0.5);
}

/* --- Rail Horizontal Track --- */
.zinstrel-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(280px, 320px);
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
    scrollbar-color: var(--terminal-dim, rgba(255, 77, 109, 0.4)) rgba(0, 0, 0, 0.3);
    scroll-snap-type: x mandatory;
}

.zinstrel-track::-webkit-scrollbar {
    height: 6px;
}

.zinstrel-track::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-dim-rgb, 255, 77, 109), 0.5);
    border-radius: 3px;
}

.zinstrel-track::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

/* --- Dispatch Card --- */
.zinstrel-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: rgba(8, 18, 32, 0.85);
    border: 1px solid rgba(var(--accent-dim-rgb, 255, 77, 109), 0.3);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.2s ease,
                box-shadow 0.2s ease;
    scroll-snap-align: start;
    user-select: none;
}

.zinstrel-card:hover {
    transform: translateY(-3px);
    border-color: rgba(var(--accent-rgb, 255, 77, 109), 0.7);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), 0 0 16px rgba(var(--accent-rgb, 255, 77, 109), 0.2);
}

.zinstrel-card-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    background-color: #040912;
    overflow: hidden;
}

.zinstrel-card-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(8, 18, 32, 0.95) 0%, rgba(8, 18, 32, 0.2) 60%, transparent 100%);
    pointer-events: none;
}

.zinstrel-card-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    font-size: 0.62rem;
    font-family: var(--font-mono, 'Space Mono', monospace);
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(4, 10, 18, 0.85);
    border: 1px solid rgba(0, 240, 255, 0.5);
    color: #00f0ff;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
    text-transform: uppercase;
}

.zinstrel-card-date-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    font-size: 0.62rem;
    font-family: var(--font-mono, 'Space Mono', monospace);
    color: #ffffff;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.zinstrel-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 12px;
    gap: 8px;
}

.zinstrel-card-title {
    font-family: var(--font-heading, 'Space Grotesk', sans-serif);
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff !important;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.6em;
}

.zinstrel-card-excerpt {
    font-size: 0.74rem;
    line-height: 1.45;
    color: #94a3b8;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.zinstrel-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--terminal-dim, rgba(255, 77, 109, 0.75));
    font-family: var(--font-mono, 'Space Mono', monospace);
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    padding-top: 8px;
    margin-top: 2px;
}

.zinstrel-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.zinstrel-btn-read {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.72rem;
    font-family: var(--font-mono, 'Space Mono', monospace);
    font-weight: 600;
    text-align: center;
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid rgba(0, 240, 255, 0.45);
    color: #00f0ff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.zinstrel-btn-read:hover {
    background: #00f0ff;
    color: #000000;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
}

.zinstrel-btn-ext {
    padding: 6px 10px;
    font-size: 0.72rem;
    font-family: var(--font-mono, 'Space Mono', monospace);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}

.zinstrel-btn-ext:hover {
    background: rgba(255, 77, 109, 0.2);
    border-color: var(--terminal-green, #ff4d6d);
    color: var(--terminal-green, #ff4d6d);
}

.zinstrel-btn-full {
    flex: 1;
    padding: 7px 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.4);
    color: #00f0ff;
}

.zinstrel-btn-full:hover {
    background: rgba(0, 240, 255, 0.22);
    border-color: #00f0ff;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
}

.zinstrel-card--direct:hover .zinstrel-card-title {
    color: #00f0ff;
}

/* --- In-Page Playback-Safe Reader Modal --- */
.zinstrel-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 12, 0.85);
    backdrop-filter: blur(14px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.zinstrel-modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.zinstrel-reader-card {
    width: 100%;
    max-width: 820px;
    max-height: 88vh;
    background: rgba(7, 16, 28, 0.96);
    border: 1px solid rgba(0, 240, 255, 0.35);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8), 0 0 24px rgba(0, 240, 255, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: zinstrelModalSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zinstrelModalSlide {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.zinstrel-reader-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 24px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 16px;
    background: rgba(4, 10, 18, 0.8);
}

.zinstrel-modal-kicker {
    font-family: var(--font-mono, 'Space Mono', monospace);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #00f0ff;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.zinstrel-reader-title {
    font-family: var(--font-heading, 'Space Grotesk', sans-serif);
    font-size: 1.35rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.3;
    margin: 0;
}

.zinstrel-modal-close {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 1.4rem;
    line-height: 1;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.zinstrel-modal-close:hover {
    background: rgba(255, 77, 109, 0.2);
    border-color: #ff4d6d;
    color: #ff4d6d;
}

.zinstrel-reader-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px 32px;
    color: #e2e8f0;
    scrollbar-color: rgba(0, 240, 255, 0.4) rgba(0, 0, 0, 0.2);
}

.zinstrel-reader-body::-webkit-scrollbar {
    width: 8px;
}

.zinstrel-reader-body::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.4);
    border-radius: 4px;
}

.zinstrel-reader-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono, 'Space Mono', monospace);
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.zinstrel-reader-author {
    color: #ffffff;
    font-weight: 700;
}

.zinstrel-reader-cover {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 22px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.zinstrel-reader-prose {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1.02rem;
    line-height: 1.75;
    color: #cbd5e1;
}

.zinstrel-reader-prose p {
    margin-bottom: 1.25em;
}

.zinstrel-reader-prose strong {
    color: #ffffff;
    font-weight: 700;
}

.zinstrel-reader-prose h2,
.zinstrel-reader-prose h3 {
    font-family: var(--font-heading, 'Space Grotesk', sans-serif);
    color: #00f0ff;
    margin-top: 1.8em;
    margin-bottom: 0.8em;
    line-height: 1.3;
}

.zinstrel-reader-prose blockquote {
    border-left: 3px solid #ff4d6d;
    background: rgba(255, 77, 109, 0.08);
    padding: 12px 18px;
    margin: 1.5em 0;
    border-radius: 0 6px 6px 0;
    color: #f1f5f9;
    font-style: italic;
}

.zinstrel-reader-prose a {
    color: #00f0ff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.zinstrel-reader-prose a:hover {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.zinstrel-reader-prose img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1.5em 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.zinstrel-reader-prose figure {
    margin: 1.5em 0;
}

.zinstrel-reader-prose figcaption {
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
    margin-top: 6px;
    font-family: var(--font-mono, 'Space Mono', monospace);
}

.zinstrel-reader-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: rgba(4, 10, 18, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    gap: 12px;
    flex-wrap: wrap;
}

.zinstrel-sub-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #ff4d6d 0%, #ff758f 100%);
    color: #ffffff !important;
    font-family: var(--font-heading, 'Space Grotesk', sans-serif);
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 6px;
    text-decoration: none;
    box-shadow: 0 0 16px rgba(255, 77, 109, 0.4);
    transition: all 0.2s ease;
}

.zinstrel-sub-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 24px rgba(255, 77, 109, 0.65);
}

.zinstrel-btn-close-foot {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #cbd5e1;
    font-family: var(--font-mono, 'Space Mono', monospace);
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.zinstrel-btn-close-foot:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* Loading & Empty states */
.zinstrel-loading,
.zinstrel-empty {
    padding: 24px;
    text-align: center;
    color: #64748b;
    font-family: var(--font-mono, 'Space Mono', monospace);
    font-size: 0.82rem;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .zinstrel-track {
        grid-auto-columns: 240px;
    }

    .zinstrel-reader-card {
        max-height: 94vh;
        border-radius: 8px;
    }

    .zinstrel-reader-header,
    .zinstrel-reader-body,
    .zinstrel-reader-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .zinstrel-reader-title {
        font-size: 1.15rem;
    }
}
