/*
 * Changelog/Release Notes Layout
 *
 * Timeline-based design for changelogs and release notes.
 * Inspired by the resume work history timeline.
 */

/* ============================================
   CONTAINER & HEADER
   ============================================ */

.changelog-container {
    max-width: var(--prose-width);
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}

.changelog-header {
    margin-bottom: var(--space-10);
    text-align: center;
}

/* Moved to layouts/page-header.css - use .page-header.page-header--centered */

.changelog-description {
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    margin: 0;
    max-width: 600px;
    margin-inline: auto;
    line-height: var(--leading-relaxed);
}

/* ============================================
   TIMELINE STRUCTURE
   ============================================ */

.changelog-timeline {
    margin-top: var(--space-8);
}

.timeline {
    position: relative;
}

.timeline-item {
    margin-bottom: var(--space-10);
    padding-inline-start: var(--space-6);
    /* Changed from padding-left */
    border-inline-start: 2px solid var(--color-border-light);
    /* Changed from border-left */
    position: relative;
    transition: transform var(--transition-fast) var(--ease-out),
        border-color var(--transition-fast) var(--ease-out);

}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-item:hover {
    border-inline-start-color: var(--color-primary);
    /* Changed from border-left-color */
    transform: translate3d(4px, 0, 0);
}

/* Timeline dot marker */
.timeline-item::before {
    content: '';
    position: absolute;
    inset-inline-start: -6px;
    /* Changed from left */
    inset-block-start: 4px;
    /* Changed from top */
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    border: 2px solid var(--color-bg-primary);
    box-shadow: 0 0 0 2px var(--color-primary);
    transition: transform var(--transition-smooth) var(--ease-smooth),
        background var(--transition-fast) var(--ease-out);
    will-change: transform;
}

.timeline-item:hover::before {
    transform: translate3d(0, 0, 0) scale(1.2);
}

@supports (color: color-mix(in srgb, white, black)) {
    .timeline-item:hover::before {
        background: color-mix(in srgb, var(--color-primary) 90%, black);
    }
}

/* ============================================
   RELEASE HEADER
   ============================================ */

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.timeline-title-group {
    flex: 1;
    min-width: 200px;
}

.timeline-title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    margin: 0 0 var(--space-1) 0;
    color: var(--color-text-primary);
}

.timeline-title a {
    color: var(--color-text-primary);
    text-decoration: none;
    transition: color var(--transition-smooth) var(--ease-smooth);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.timeline-title a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

@supports (color: color-mix(in srgb, white, black)) {
    .timeline-title a:hover {
        color: color-mix(in srgb, var(--color-primary) 90%, black);
    }
}

.timeline-subtitle {
    font-size: var(--text-base);
    color: var(--color-text-tertiary);
    margin: 0;
    font-weight: var(--weight-medium);
}

.timeline-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-2);
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.timeline-date {
    font-weight: var(--weight-medium);
    color: var(--color-text-secondary);
}

.release-status {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.release-status.status-stable,
.release-status.status-released {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.release-status.status-beta,
.release-status.status-preview {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.release-status.status-alpha,
.release-status.status-experimental {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.release-status.status-deprecated {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.timeline-description {
    margin: 0 0 var(--space-4) 0;
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
    font-size: var(--text-base);
}

/* ============================================
   CHANGELOG CATEGORIES
   ============================================ */

.changelog-category {
    margin: var(--space-4) 0;
    padding: var(--space-4);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    border-inline-start: 3px solid var(--color-border-light);
    /* Changed from border-left */
    transition: transform var(--transition-smooth) var(--ease-smooth),
        box-shadow var(--transition-smooth) var(--ease-smooth);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    will-change: transform, box-shadow;

}

.changelog-category:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: var(--elevation-card-hover);
}

.changelog-category.changelog-breaking,
.changelog-category--breaking {
    background: var(--color-danger-bg);
    border-inline-start-color: var(--color-danger);
    border-inline-start-width: 4px;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

.changelog-category.changelog-breaking:hover,
.changelog-category--breaking:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

@supports (color: color-mix(in srgb, white, black)) {

    .changelog-category.changelog-breaking:hover,
    .changelog-category--breaking:hover {
        border-inline-start-color: color-mix(in srgb, var(--color-danger) 90%, black);
    }
}

.category-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin: 0 0 var(--space-3) 0;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.changelog-breaking .category-title,
.category-title--breaking {
    color: var(--color-danger);
    font-weight: var(--weight-bold);
}

.changelog-list {
    margin: 0;
    padding-inline-start: var(--space-6);
    list-style: disc;
}

.changelog-list li {
    margin-bottom: var(--space-2);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

.changelog-list li:last-child {
    margin-bottom: 0;
}

.changelog-list li::marker {
    color: var(--color-primary);
}

.changelog-breaking .changelog-list li::marker,
.changelog-list--breaking li::marker {
    color: var(--color-danger);
}

.changelog-item--breaking {
    font-weight: var(--weight-medium);
    color: var(--color-text-primary);
}

/* ============================================
   READ MORE LINK
   ============================================ */

.changelog-read-more {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding: var(--space-2) var(--space-4);
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--weight-medium);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    transition: all var(--transition-smooth) var(--ease-smooth);
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, background;

}

.changelog-read-more:hover {
    background: var(--color-primary);
    color: var(--color-bg-primary);
    transform: translate3d(2px, 0, 0);
    box-shadow: var(--elevation-low);
}

@supports (color: color-mix(in srgb, white, black)) {
    .changelog-read-more:hover {
        background: color-mix(in srgb, var(--color-primary) 90%, black);
    }
}

.changelog-read-more:active {
    transform: translate3d(0, 0, 0);
}

/* ============================================
   SINGLE RELEASE PAGE
   ============================================ */

.changelog-single {
    max-width: var(--prose-width);
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}

.release-header {
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-block-end: 2px solid var(--color-border-light);
}

.release-header h1 {
    font-size: var(--text-4xl);
    font-weight: var(--weight-bold);
    margin: 0 0 var(--space-3) 0;
    color: var(--color-text-primary);
}

.release-name {
    font-size: var(--text-xl);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-4) 0;
    font-weight: var(--weight-medium);
}

.release-meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.release-date {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    font-weight: var(--weight-medium);
}

.release-summary {
    margin-top: var(--space-4);
    font-size: var(--text-lg);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

.release-content {
    margin-top: var(--space-6);
}

/* Hide or reduce spacing for first hr in release content to avoid double line with header border */
.release-details.prose>hr:first-child {
    margin-top: 0;
    border-top: none;
    display: none;
    /* Hide first hr since header already has border */
}

.release-content .changelog-category {
    margin-bottom: var(--space-6);
}

.release-content .category-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-4);
}

.release-details {
    margin-top: var(--space-8);
    padding-top: var(--space-8);
    /* Removed border-block-start - header already has border-block-end for separation */
}

/* Headings in release content inherit standard typography styles from base/typography.css */
/* Only override first heading top margin since container already provides spacing */
.release-details.prose>h1:first-child,
.release-details.prose>h2:first-child {
    margin-top: 0;
}

.release-footer {
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-block-start: 1px solid var(--color-border-light);
    /* Changed from border-top */
}

.release-links {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.release-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    text-decoration: none;
    font-weight: var(--weight-medium);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-smooth) var(--ease-smooth);
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, background, box-shadow;

}

.release-link:hover {
    background: var(--color-primary);
    color: var(--color-bg-primary);
    border-color: var(--color-primary);
    transform: translate3d(0, -1px, 0);
    box-shadow: var(--elevation-low);
}

@supports (color: color-mix(in srgb, white, black)) {
    .release-link:hover {
        background: color-mix(in srgb, var(--color-primary) 90%, black);
    }
}

.release-link:active {
    transform: translate3d(0, 0, 0);
}

.release-download {
    background: var(--color-primary);
    color: var(--color-bg-primary);
    border-color: var(--color-primary);

}

.release-download:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

@supports (color: color-mix(in srgb, white, black)) {
    .release-download:hover {
        background: color-mix(in srgb, var(--color-primary-dark) 90%, black);
    }
}

/* ============================================
   FILTER BUTTONS
   ============================================ */

.changelog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin: var(--space-8) 0;
    padding: var(--space-4);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    justify-content: center;
}

.changelog-filter-btn {
    padding: var(--space-2) var(--space-4);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    cursor: pointer;
    transition: all var(--transition-fast) var(--ease-out);
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.changelog-filter-btn:hover {
    background: var(--color-surface);
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.changelog-filter-btn.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.changelog-filter-btn.active:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.changelog-filter-btn:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .changelog-filters {
        padding: var(--space-3);
        gap: var(--space-2);
    }

    .changelog-filter-btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-xs);
    }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.changelog-empty {
    text-align: center;
    padding: var(--space-16) var(--space-4);
    color: var(--color-text-tertiary);
}

.changelog-content {
    margin-top: var(--space-6);
}

/* ============================================
   RESPONSIVE: ULTRA-WIDE (Better Proportions)
   ============================================ */

/* Ultra-wide screens - wider container, more breathing room */
@media (min-width: 1920px) {
    .changelog-container,
    .changelog-single {
        max-width: var(--container-xl, 1280px);
        padding: var(--space-10) var(--space-8);
    }

    /* Timeline content remains readable width */
    .timeline {
        max-width: var(--prose-width);
        margin-inline: auto;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {

    .changelog-container,
    .changelog-single {
        padding: var(--space-6) var(--space-4);
    }

    .changelog-header h1,
    .release-header h1 {
        font-size: var(--text-3xl);
    }

    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .timeline-meta {
        align-items: flex-start;
        flex-direction: row;
        gap: var(--space-3);
    }

    .timeline-title {
        font-size: var(--text-xl);
    }

    .timeline-item {
        padding-inline-start: var(--space-4);
    }

    .changelog-category {
        padding: var(--space-3);
    }

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

    .release-link {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .timeline-item::before {
        border-color: var(--color-bg-primary);
        box-shadow: 0 0 0 2px var(--color-primary);
    }

    :root:not([data-theme="light"]) .changelog-category {
        background: var(--color-bg-tertiary);
    }

    :root:not([data-theme="light"]) .changelog-category.changelog-breaking {
        background: rgba(220, 38, 38, 0.1);
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {

    .timeline-item,
    .changelog-category,
    .changelog-read-more,
    .release-link,
    .changelog-list li {
        transition: none !important;
        animation: none !important;
        will-change: auto !important;
        transform: none !important;
    }
}
