/* ============================================
   What's new page (src/pages/whats_new/layout.py)
   Block: whats-new
   ============================================ */

.whats-new {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 4px 48px;
    box-sizing: border-box;
}

/* Colors of each kind of change: chips, counts and the stripe of each card. */
.whats-new__type--new,
.whats-new__count--new,
.whats-new__item--new {
    --wn-ink: #1d4ed8;
    --wn-tint: #dbeafe;
    --wn-line: #93c5fd;
    --wn-accent: #3b82f6;
}

.whats-new__type--improvement,
.whats-new__count--improvement,
.whats-new__item--improvement {
    --wn-ink: #15803d;
    --wn-tint: #dcfce7;
    --wn-line: #86efac;
    --wn-accent: #22c55e;
}

.whats-new__type--fix,
.whats-new__count--fix,
.whats-new__item--fix {
    --wn-ink: #b45309;
    --wn-tint: #fef3c7;
    --wn-line: #fcd34d;
    --wn-accent: #f59e0b;
}

/* Timeline: one section per update, newest first */
.whats-new__timeline {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.whats-new__release {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    column-gap: 20px;
}

.whats-new__rail {
    position: relative;
    display: flex;
    justify-content: center;
}

.whats-new__rail::before {
    content: "";
    position: absolute;
    top: 18px;
    bottom: -52px; /* gap between releases (48px) + margin-top of the next marker (4px) */
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: hsl(var(--border));
}

.whats-new__release:last-child .whats-new__rail::before {
    bottom: 0;
}

.whats-new__marker {
    position: relative;
    z-index: 1;
    width: 16px;
    height: 16px;
    margin-top: 4px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 3px solid hsl(var(--muted) / 0.6);
    background: hsl(var(--background));
}

.whats-new__release--latest .whats-new__marker {
    border-color: hsl(var(--accent-brand));
    box-shadow: 0 0 0 4px hsl(var(--accent-brand) / 0.2);
}

.whats-new__release-body {
    min-width: 0;
}

.whats-new__release-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    min-height: 24px;
}

.whats-new__date {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
}

.whats-new__latest {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid hsl(var(--accent-brand) / 0.5);
    background: hsl(var(--accent-brand) / 0.15);
    color: hsl(var(--foreground));
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}

.whats-new__release-title {
    margin: 8px 0 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    color: hsl(var(--foreground));
}

.whats-new__release-summary {
    max-width: 75ch;
    margin: 8px 0 0;
    font-size: 1rem;
    line-height: 1.6;
    color: hsl(var(--muted-foreground));
}

.whats-new__counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.whats-new__type,
.whats-new__count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--wn-line);
    border-radius: 999px;
    background: var(--wn-tint);
    color: var(--wn-ink);
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.whats-new__type {
    padding: 2px 10px;
    font-size: 0.75rem;
}

.whats-new__count {
    padding: 4px 12px;
    font-size: 0.8125rem;
}

/* Changes grouped by the page they change */
.whats-new__page {
    margin-top: 28px;
}

.whats-new__page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid hsl(var(--border));
}

.whats-new__page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.whats-new__page-icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--app-radius, 8px);
    background: hsl(var(--accent));
    color: hsl(var(--foreground));
}

.whats-new__page-name {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
    color: hsl(var(--foreground));
}

.whats-new__items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.whats-new__item {
    position: relative;
    overflow: hidden;
    padding: 16px 20px 16px 24px;
    border: 1px solid var(--card-border);
    border-radius: var(--app-radius, 8px);
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
}

.whats-new__item::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: var(--wn-accent);
}

.whats-new__item-title {
    margin: 10px 0 0;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.4;
    color: hsl(var(--foreground));
}

.whats-new__item-text {
    max-width: 75ch;
    margin: 6px 0 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: hsl(var(--muted-foreground));
}

/* Before / now times */
.whats-new__metrics {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--app-radius, 8px);
    background: var(--surface-soft, #f8f9fa);
}

.whats-new__metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px 32px;
}

.whats-new__metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* A long name takes two lines: the head grows so the bars of a row stay aligned at the bottom. */
.whats-new__metric-head {
    display: flex;
    flex: 1 0 auto;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 8px;
}

.whats-new__metric-label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.whats-new__metric-factor {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #15803d;
    white-space: nowrap;
}

.whats-new__bar {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}

.whats-new__bar-name {
    color: hsl(var(--muted-foreground));
}

.whats-new__bar-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: hsl(var(--border));
}

.whats-new__bar-fill {
    height: 100%;
    border-radius: 999px;
}

.whats-new__bar-fill--before {
    background: hsl(var(--muted) / 0.55);
}

.whats-new__bar-fill--after {
    background: hsl(var(--accent-brand));
}

.whats-new__bar-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    color: hsl(var(--foreground));
}

.whats-new__bar--before .whats-new__bar-value {
    font-weight: 500;
    color: hsl(var(--muted-foreground));
}

.whats-new__note {
    margin: 14px 0 0;
    font-size: 0.75rem;
    line-height: 1.5;
    color: hsl(var(--muted-foreground));
}

/* No updates to show */
.whats-new__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 16px;
    border: 1px dashed hsl(var(--border));
    border-radius: var(--app-radius, 8px);
    text-align: center;
    color: hsl(var(--muted-foreground));
}

.whats-new__empty-title {
    margin: 8px 0 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}

.whats-new__empty-text {
    max-width: 48ch;
    margin: 0;
}

@media (max-width: 576px) {
    .whats-new__release {
        grid-template-columns: 16px minmax(0, 1fr);
        column-gap: 12px;
    }

    .whats-new__marker {
        width: 14px;
        height: 14px;
    }

    .whats-new__release-title {
        font-size: 1.25rem;
    }

    .whats-new__item {
        padding: 14px 14px 14px 18px;
    }

    .whats-new__metrics {
        padding: 12px;
    }

    .whats-new__metric-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
