/* =========================================================
   CHANGELOG
   Dedicated, page-scoped layout for /cap-nhat/.
   ========================================================= */

html,
body {
    overflow-x: clip !important;
}

html {
    scroll-padding-top: 104px;
    scroll-behavior: smooth;
}

.changelog-shell {
    width: 100%;
    max-width: 1280px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 112px 32px 96px;
}

.changelog-page .dispositio {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: clamp(40px, 5vw, 72px);
    width: 100%;
    align-items: start;
}

/* Release navigation */
.changelog-page .margo {
    position: sticky;
    top: 92px;
    width: 100%;
    max-height: calc(100vh - 116px);
    padding: 20px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(245, 158, 11, 0.045), transparent 34%),
        rgba(15, 23, 42, 0.4);
    box-shadow: 0 18px 48px rgba(2, 6, 23, 0.16);
    backdrop-filter: blur(12px);
}

.changelog-page .margo::-webkit-scrollbar {
    width: 4px;
}

.changelog-page .margo::-webkit-scrollbar-track {
    background: transparent;
}

.changelog-page .margo::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.45);
}

.changelog-page .margo > .index {
    margin: 0 10px 12px;
    color: var(--J-gray-4, #94a3b8);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.changelog-nav-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.changelog-page .nexus {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 9px 10px;
    border-radius: 9px;
    color: #94a3b8;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    opacity: 1;
    text-decoration: none;
    transition: color 160ms ease, background-color 160ms ease;
}

.changelog-page .nexus:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.055);
}

.changelog-page .nexus.is-active {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.08);
}

/* Release content */
.changelog-page .materies {
    min-width: 0;
    width: 100%;
    max-width: 860px;
}

.changelog-page .materies > h1.index {
    max-width: 760px;
    margin: 0 0 52px;
    color: #f8fafc;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: clamp(42px, 5vw, 58px);
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: -0.035em;
    text-transform: none;
}

.changelog-page .materies > h1.index::after {
    content: "";
    display: block;
    width: 64px;
    height: 3px;
    margin-top: 24px;
    border-radius: 999px;
    background: var(--J-accent, #f59e0b);
}

.changelog-page .fasciculus {
    margin: 0 0 72px;
    scroll-margin-top: 104px;
}

.changelog-page .inscriptio {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 18px;
    padding: 0 0 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    color: #fbbf24;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.4;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.changelog-page .versus {
    display: block;
    padding: 0;
}

.version-description {
    margin: 0 0 30px;
    color: #cbd5e1;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 18px;
    font-style: italic;
    line-height: 1.65;
}

.version-description p {
    margin: 0 0 16px;
}

.changelog-item {
    width: 100%;
    padding: 28px 0 32px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.changelog-item:last-child {
    border-bottom: 0;
}

.changelog-page .titulus {
    display: block;
    margin: 0 0 16px;
    color: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(21px, 2.4vw, 25px);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.016em;
}

.changelog-page .sententia {
    margin: 0;
    color: #cbd5e1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16.5px;
    line-height: 1.75;
}

.changelog-page .sententia p {
    display: block;
    margin: 0 0 17px;
    line-height: inherit;
    text-align: left;
}

.changelog-page .sententia p:last-child {
    margin-bottom: 0;
}

.changelog-page .sententia strong {
    color: #f8fafc;
    font-weight: 700;
}

.changelog-page .sententia a {
    color: #fbbf24;
    text-underline-offset: 3px;
}

.changelog-page .sententia ul,
.changelog-page .sententia ol {
    display: block;
    margin: 14px 0 20px 24px;
    padding-left: 20px;
}

.changelog-page .sententia li {
    margin: 0 0 9px;
    padding-left: 5px;
    line-height: 1.65;
}

.changelog-page .sententia li::marker {
    color: #f59e0b;
}

.changelog-page .sententia li > p {
    display: inline;
    margin: 0;
}

.changelog-page .sententia pre {
    margin: 22px 0;
    padding: 18px 20px;
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.72);
}

.changelog-page .sententia code {
    color: #e2e8f0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.86em;
    white-space: pre-wrap;
}

.changelog-page .sententia img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    margin: 24px auto;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(2, 6, 23, 0.28);
    cursor: zoom-in;
}

.diff-del,
.diff-add,
.diff-info {
    display: block;
}

.diff-del {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
}

.diff-add {
    color: #86efac;
    background: rgba(34, 197, 94, 0.08);
}

.diff-info {
    color: #93c5fd;
}

.changelog-empty-state {
    padding: 40px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 14px;
    color: #94a3b8;
    text-align: center;
}

/* Image lightbox */
.custom-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    visibility: hidden;
    opacity: 0;
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(10px);
    cursor: zoom-out;
    transition: opacity 220ms ease, visibility 220ms ease;
}

.custom-lightbox.active {
    visibility: visible;
    opacity: 1;
}

.custom-lightbox img {
    max-width: min(1100px, 94vw);
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

@media (max-width: 900px) {
    .changelog-page .dispositio {
        grid-template-columns: 210px minmax(0, 1fr);
        gap: 32px;
    }
}

@media (max-width: 760px) {
    html {
        scroll-padding-top: 88px;
    }

    .changelog-shell {
        padding: 92px 18px 68px;
    }

    .changelog-page .dispositio {
        display: flex;
        flex-direction: column;
        gap: 42px;
    }

    .changelog-page .margo {
        position: static;
        max-height: none;
        padding: 16px 14px;
        overflow: visible;
    }

    .changelog-nav-menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .changelog-page .materies > h1.index {
        margin-bottom: 42px;
        font-size: clamp(36px, 11vw, 48px);
    }

    .changelog-page .fasciculus {
        margin-bottom: 58px;
    }

    .changelog-page .sententia {
        font-size: 16px;
        line-height: 1.7;
    }

    .changelog-page .sententia ul,
    .changelog-page .sententia ol {
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .changelog-page *,
    .custom-lightbox {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
