/**
 * New Story Showcase Block - Frontend Styling  
 * Clean hero layout for frontpage engagement
 */

/* ================================================================
   Main Container
   ================================================================ */

.qm-new-story-showcase {
    --qm-bg-color: #ffffff;
    --qm-text-color: #333333;
    /* --qm-accent-color: removed to use Color Manager V2 global variable */
    --qm-border-radius: 12px;
    --qm-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --qm-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    
    background: var(--qm-bg-color);
    color: var(--qm-text-color);
    border-radius: var(--qm-border-radius);
    box-shadow: var(--qm-shadow);
    overflow: hidden;
    transition: all 0.3s ease;
    margin: 0;
}

.qm-new-story-showcase:hover {
    box-shadow: var(--qm-shadow-hover);
    transform: translateY(-2px);
}

/* Hero Style Enhancement */
.qm-new-story-showcase.qm-hero-style {
    background: linear-gradient(135deg, 
        var(--qm-bg-color) 0%, 
        color-mix(in srgb, var(--qm-accent-color) 5%, var(--qm-bg-color)) 100%
    );
}

/* ================================================================
   Story Carousel Navigation (Multiple Stories)
   ================================================================ */

/* Hide carousel data script */
.qm-carousel-data {
    display: none;
}

/* Dots navigation - centered above content */
.qm-dots-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem 0;
}

.qm-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: color-mix(in srgb, var(--qm-accent-color) 30%, transparent);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    position: relative;
}

.qm-dot:hover {
    background: color-mix(in srgb, var(--qm-accent-color) 60%, transparent);
    transform: scale(1.2);
}

.qm-dot.qm-active {
    background: var(--qm-accent-color, #007cba);
    transform: scale(1.3);
}

.qm-dot:focus {
    outline: 2px solid var(--qm-accent-color, #007cba);
    outline-offset: 2px;
}

/* Touch-friendly larger hit area */
.qm-dot::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
}

/* Swipe area - make story content swipeable */
.qm-story-content {
    position: relative;
    touch-action: pan-y pinch-zoom; /* Allow vertical scroll, prevent horizontal */
    cursor: grab;
}

.qm-story-content.qm-swiping {
    cursor: grabbing;
    user-select: none;
}

/* ================================================================
   Story Header
   ================================================================ */

.qm-story-header {
    padding: 1rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-direction: column;
}

/* Story meta row with badge and author */
.qm-story-meta-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0;
    flex-wrap: wrap;
}

.qm-story-badge {
    flex-shrink: 0;
}

.qm-story-timeline-context {
    color: color-mix(in srgb, var(--qm-text-color) 60%, transparent);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    background: color-mix(in srgb, var(--qm-accent-color) 8%, transparent);
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--qm-accent-color) 15%, transparent);
    flex-shrink: 0;
}

.qm-story-author {
    color: color-mix(in srgb, var(--qm-text-color) 70%, transparent);
    font-size: 0.9rem;
    font-style: italic;
    flex-shrink: 0;
}

.qm-badge-icon {
    font-size: 1.2em;
}

.qm-story-context {
    background: color-mix(in srgb, var(--qm-accent-color) 10%, transparent);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--qm-accent-color, #007cba);
    font-weight: 500;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    align-self: flex-start;
    border-left: 3px solid var(--qm-accent-color, #007cba);
}

/* ================================================================
   Story Content
   ================================================================ */

.qm-story-content {
    padding: 1.5rem;
}

.qm-story-meta {
    margin-bottom: 1.5rem;
}

.qm-story-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--qm-text-color);
    margin: 0 !important;
    line-height: 1.2;
}

.qm-story-title a {
    color: inherit;
    text-decoration: none;
}

.qm-story-title a:hover {
    color: inherit;
    text-decoration: none;
}

/* Specific targeting for h2 story titles */
h2.qm-story-title {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
}

.qm-story-date {
    font-size: 0.95rem;
    color: color-mix(in srgb, var(--qm-text-color) 70%, transparent);
    font-weight: 500;
}

.qm-story-image {
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;
}

.qm-story-image img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.qm-story-showcase:hover .qm-story-image img {
    transform: scale(1.02);
}

/* ================================================================
   Story Text Content
   ================================================================ */

.qm-story-preview {
    margin: 1.5rem 0;
}

.qm-story-excerpt {
    font-size: 1.1rem;
    line-height: 1.65;
    color: var(--qm-text-color);
}

.qm-story-excerpt p {
    margin-bottom: 1rem;
}

.qm-story-excerpt p:last-child {
    margin-bottom: 0;
}

/* Full Content (Initially Hidden) */
.qm-story-full-content {
    margin: 1.5rem 0;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--qm-text-color);
}

.qm-story-full-content.qm-expanded {
    display: block !important;
    animation: qm-fade-in 0.3s ease;
}

.qm-story-full-content p {
    margin-bottom: 1.2rem;
}

.qm-story-full-content h2,
.qm-story-full-content h3,
.qm-story-full-content h4 {
    margin: 2rem 0 1rem 0;
    color: var(--qm-text-color);
}

/* ================================================================
   Action Buttons
   ================================================================ */

.qm-story-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid color-mix(in srgb, var(--qm-text-color) 10%, transparent);
}

.qm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid;
    background: transparent;
    font-family: inherit;
}

.qm-btn-primary {
    background: var(--qm-accent-color, #007cba);
    color: white;
    border-color: var(--qm-accent-color, #007cba);
}

.qm-btn-primary:hover {
    background: color-mix(in srgb, var(--qm-accent-color) 85%, black);
    border-color: color-mix(in srgb, var(--qm-accent-color) 85%, black);
    transform: translateY(-1px);
}

.qm-btn-secondary {
    background: transparent;
    color: var(--qm-accent-color, #007cba);
    border-color: var(--qm-accent-color, #007cba);
}

.qm-btn-secondary:hover {
    background: color-mix(in srgb, var(--qm-accent-color) 10%, transparent);
}

/* Expand story button follows site-wide color system */
.qm-expand-story.qm-btn-primary {
    background: var(--qm-accent-color, #007cba);
    border-color: var(--qm-accent-color, #007cba);
    color: white;
}

.qm-btn-icon {
    font-size: 1.1em;
}

/* ================================================================
   Timeline Panel
   ================================================================ */

.qm-timeline-panel {
    background: color-mix(in srgb, var(--qm-accent-color) 5%, var(--qm-bg-color));
    border-top: 1px solid color-mix(in srgb, var(--qm-accent-color) 15%, transparent);
    padding: 1.5rem;
    position: relative;
}

.qm-timeline-panel.qm-show {
    display: block !important;
    animation: qm-slide-down 0.3s ease;
}

.qm-timeline-panel h4 {
    margin: 0 0 1rem 0;
    color: var(--qm-accent-color, #007cba);
    font-size: 1.2rem;
    font-weight: 600;
}

.qm-timeline-position {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    border-left: 4px solid var(--qm-accent-color, #007cba);
}

.qm-timeline-position p {
    margin: 0;
    font-size: 0.95rem;
}

.qm-mini-timeline {
    margin: 1rem 0;
}

.qm-timeline-mini-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.qm-timeline-mini-item {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    border-left: 3px solid color-mix(in srgb, var(--qm-accent-color) 30%, transparent);
    transition: all 0.2s ease;
}

.qm-timeline-mini-item.qm-current {
    background: color-mix(in srgb, var(--qm-accent-color) 15%, white);
    border-left-color: var(--qm-accent-color, #007cba);
    font-weight: 600;
}

.qm-timeline-mini-item a {
    color: var(--qm-text-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.qm-timeline-mini-item:hover {
    background: color-mix(in srgb, var(--qm-accent-color) 10%, white);
}

.qm-close-timeline {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: color-mix(in srgb, var(--qm-text-color) 60%, transparent);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.qm-close-timeline:hover {
    background: color-mix(in srgb, var(--qm-text-color) 10%, transparent);
    color: var(--qm-text-color);
}

/* ================================================================
   Responsive Design
   ================================================================ */

@media (max-width: 768px) {
    .qm-new-story-showcase {
        margin: 1rem 0;
        border-radius: 8px;
    }
    
    .qm-story-header {
        padding: 1rem 1rem 0;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .qm-story-content {
        padding: 1rem;
    }
    
    .qm-story-title {
        font-size: 1.5rem;
    }
    
    .qm-story-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .qm-btn {
        justify-content: center;
        width: 100%;
    }
    
    .qm-dots-nav {
        margin: 0.25rem 0 0.75rem 0;
        gap: 0.4rem;
    }

    .qm-dot {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .qm-story-badge {
        font-size: 1.25rem;
    }
    
    .qm-story-title {
        font-size: 1.3rem;
    }
    
    .qm-story-excerpt {
        font-size: 1rem;
    }
}

/* ================================================================
   Animations
   ================================================================ */

@keyframes qm-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes qm-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================================
   Editor Specific Styling
   ================================================================ */

.qm-new-story-showcase-editor .qm-new-story-showcase-preview {
    min-height: 250px;
    position: relative;
}

/* ================================================================
   No Content State
   ================================================================ */

.qm-new-story-showcase.qm-no-content {
    padding: 2rem;
    text-align: center;
    color: color-mix(in srgb, var(--qm-text-color) 60%, transparent);
    background: color-mix(in srgb, var(--qm-text-color) 5%, transparent);
}