:root {
    --page-gutter: clamp(20px, 3vw, 64px);
    --site-header-height: 88px;
    --surface-line: rgba(252, 213, 136, .15);
}

html {
    scroll-padding-top: calc(var(--site-header-height) + 24px);
    scrollbar-gutter: stable;
}

body .site-header.is-scrolled {
    background: #090909;
}

body .site-header {
    min-height: var(--site-header-height);
    height: var(--site-header-height);
    padding: 16px var(--page-gutter);
    gap: 32px;
    background: rgba(5, 5, 5, .94);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.site-header .logo-container {
    flex: 0 0 auto;
}

.site-header .logo-img {
    display: block;
    height: 38px;
    max-width: 180px;
}

.site-header .header-controls {
    position: static;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 24px;
    width: max-content;
    max-height: none;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: transparent;
    opacity: 1;
    transform: none;
    overflow: visible;
    pointer-events: auto;
}

.site-header .header-controls nav {
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    gap: 20px;
}

.site-header .header-controls nav a {
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

.site-header .lang-switch {
    flex: 0 0 auto;
}

.site-header a.lang-btn {
    text-decoration: none;
}

.site-header .mobile-menu-toggle {
    display: none;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin-left: auto;
}

.site-header.is-compact .mobile-menu-toggle {
    display: flex;
}

.site-header.is-compact .header-controls {
    position: fixed;
    top: calc(var(--site-header-height) + 12px);
    right: var(--page-gutter);
    left: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    width: min(420px, calc(100vw - 2 * var(--page-gutter)));
    max-height: calc(100dvh - var(--site-header-height) - 32px);
    padding: 20px;
    border: 1px solid var(--surface-line);
    border-radius: 12px;
    background: #0c0c0b;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .65);
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: none;
}

.site-header.is-compact .header-controls.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition: opacity .16s ease, transform .16s ease;
}

.site-header.is-compact .header-controls nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

.site-header.is-compact .header-controls nav a {
    min-height: 44px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    font-size: 13px;
}

.site-header.is-compact .lang-switch {
    align-self: flex-start;
}

.site-header.is-compact .lang-btn {
    min-width: 44px;
    min-height: 38px;
}

body.menu-open {
    overflow: hidden;
}

.site-header a:focus-visible,
.site-header button:focus-visible,
body .servers-container a:focus-visible,
body .servers-container summary:focus-visible {
    outline: 2px solid #fcd588;
    outline-offset: 4px;
}

body .servers-container,
body .history-container,
body .blog-container,
body .tools-container {
    width: 100%;
    max-width: none;
    margin: 40px auto 72px;
    padding: 0 var(--page-gutter);
    min-width: 0;
}

body .blog-posts {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}

body .blog-post {
    min-width: 0;
    overflow-wrap: anywhere;
}

body .blog-post-meta {
    flex-wrap: wrap;
}

body .article-container {
    width: 100%;
    min-width: 0;
    margin-top: 40px;
}

body .article-title,
body .page-title {
    font-size: clamp(28px, 3vw, 48px);
    overflow-wrap: break-word;
}

body .article-content,
body .article-content-wrapper,
body .tool-card {
    min-width: 0;
}

body .article-content-wrapper,
body .tool-card {
    padding: clamp(20px, 3vw, 48px);
}

body .article-content :not(pre) > code {
    overflow-wrap: anywhere;
}

body .article-content pre {
    max-width: 100%;
    overflow-x: auto;
}

body .converter-tabs {
    flex-wrap: wrap;
}

body .tool-input,
body .tool-textarea {
    min-width: 0;
    max-width: 100%;
}

body .breadcrumbs,
body .archive-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 28px;
    padding: 0;
    font-size: 12px;
}

body .breadcrumbs a,
body .archive-breadcrumbs a {
    margin-left: 0;
    font-size: inherit;
}

body .servers-title,
body .opening-archive .history-title {
    max-width: 100%;
    margin: 0 0 20px;
    font-family: var(--font-sans);
    font-size: clamp(30px, 3.1vw, 56px);
    line-height: 1.14;
    font-weight: 700;
    letter-spacing: -.035em;
    overflow-wrap: break-word;
}

body .servers-subtitle,
body .opening-archive .history-subtitle {
    max-width: 85ch;
    font-size: clamp(15px, 1.05vw, 18px);
    line-height: 1.75;
}

body .servers-note {
    max-width: 105ch;
    line-height: 1.7;
}

body .servers-seo-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 24px 0 32px;
}

body .servers-seo-links a {
    margin: 0;
    padding: 10px 14px;
    min-height: 42px;
    font-size: 12px;
    line-height: 1.5;
}

body .servers-toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(160px, 1fr));
    gap: 12px;
    margin: 28px 0 24px;
}

body .servers-input,
body .servers-select {
    min-width: 0;
    width: 100%;
    min-height: 48px;
}

body .servers-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 20px;
    align-items: start;
}

body .server-card {
    min-width: 0;
    padding: 24px;
}

body .server-name,
body .server-meta,
body .server-desc,
body .server-small {
    overflow-wrap: anywhere;
}

body .server-card-top {
    flex-wrap: wrap;
}

body .server-history-mini li {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, .6fr) minmax(0, 1fr);
}

body .server-history-mini li > * {
    overflow-wrap: anywhere;
}

body .servers-history-wrap {
    margin-top: 48px;
    min-width: 0;
}

body .servers-history {
    display: table;
    width: 100%;
    min-width: 650px;
}

.servers-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-color: rgba(252, 213, 136, .4) #10100f;
}

body .servers-history th,
body .servers-history td {
    min-width: 120px;
    padding: 16px 20px;
}

body .servers-history tbody,
body .servers-history thead {
    width: 100%;
}

body .chronicle-history {
    margin: 48px 0 0;
    padding: clamp(20px, 2vw, 32px);
}

body .chronicle-history > h2,
body .servers-section-title,
body .opening-archive .history-card h2 {
    font-family: var(--font-sans);
    font-size: clamp(20px, 1.7vw, 28px);
    line-height: 1.3;
    letter-spacing: -.025em;
}

body .chronicle-toc a {
    min-height: 40px;
    padding: 8px 12px;
}

body .chronicle-release {
    overflow-x: auto;
}

body .chronicle-release summary {
    min-height: 48px;
    padding: 12px 0;
    cursor: pointer;
}

body .chronicle-release table {
    min-width: 560px;
}

body .opening-archive .history-hero {
    padding: clamp(24px, 2.4vw, 40px);
    border-color: var(--surface-line);
    border-radius: 12px;
    background: rgba(15, 15, 13, .9);
    backdrop-filter: none;
}

body .opening-archive .history-hero::before,
body .opening-archive .history-hero::after {
    display: none;
}

body .opening-archive .history-kicker {
    display: none;
}

body .opening-archive .history-actions {
    margin-top: 24px;
}

body .opening-archive .history-btn {
    min-height: 46px;
    padding: 12px 18px;
    line-height: 1.5;
    text-align: center;
}

body .opening-archive .archive-metrics {
    margin: 24px 0 32px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

body .opening-archive .archive-metrics > div {
    padding: 24px;
}

body .opening-archive .archive-metrics dd {
    font-family: var(--font-mono);
    font-size: clamp(28px, 2.5vw, 40px);
    line-height: 1.2;
}

body .opening-archive .history-card {
    min-width: 0;
    padding: clamp(20px, 2vw, 32px);
    border-radius: 12px;
    background: rgba(12, 12, 11, .93);
}

body .opening-archive .archive-month-links {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0 24px;
}

body .opening-archive .archive-month-links a {
    min-height: 64px;
    align-items: center;
    gap: 12px;
    font-size: 15px;
}

body .opening-archive .archive-table-wrap {
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 8px;
    scrollbar-color: rgba(252, 213, 136, .4) #10100f;
}

body .opening-archive .archive-table {
    min-width: 650px;
    font-size: 14px;
}

body .opening-archive .archive-table th,
body .opening-archive .archive-table td {
    padding: 16px 20px;
}

body .opening-archive .archive-table thead th {
    background: #191914;
    font-size: 12px;
    line-height: 1.5;
}

body .opening-archive .archive-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, .015);
}

body .opening-archive .archive-table tbody tr:hover {
    background: rgba(252, 213, 136, .055);
}

body .opening-archive .archive-openings tbody th {
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 170px;
}

body .opening-archive .archive-breakdowns {
    gap: 24px;
    margin: 32px 0;
}

body .opening-archive .archive-distribution {
    gap: 14px;
}

body .opening-archive .archive-distribution li {
    grid-template-columns: minmax(110px, 1fr) 2fr 48px;
}

.archive-table-tools {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin: 20px 0;
}

.archive-table-tools[hidden] {
    display: none;
}

.archive-table-tools label {
    display: grid;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, .7);
}

.archive-table-tools input,
.archive-table-tools select,
.archive-table-tools button {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 6px;
    background: #11110f;
    color: #fff;
    font: inherit;
    color-scheme: dark;
}

.archive-table-tools button {
    color: #fcd588;
    cursor: pointer;
}

.archive-results,
.archive-scroll-hint,
.archive-editorial,
.archive-updated {
    margin: 16px 0;
    color: rgba(255, 255, 255, .6);
    font-size: 13px;
    line-height: 1.6;
}

.archive-scroll-hint {
    display: none;
}

body .opening-archive .archive-method {
    padding: 24px 0;
    border-top: 1px solid var(--surface-line);
}

.archive-method summary {
    min-height: 44px;
    color: #fcd588;
    font-size: 15px;
    cursor: pointer;
}

.archive-method p {
    max-width: 100ch;
}

@media (max-width: 1100px) {
    body .servers-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body .opening-archive .archive-month-links {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    :root {
        --site-header-height: 76px;
    }

    body .site-header {
        padding-block: 12px;
    }

    .site-header .logo-img {
        height: 32px;
    }

    body .servers-container,
    body .history-container,
    body .blog-container,
    body .tools-container {
        margin-top: 28px;
    }

    body .opening-archive .archive-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body .opening-archive .archive-metrics > div {
        padding: 18px;
    }

    body .opening-archive .archive-metrics > div:last-child {
        grid-column: span 2;
    }

    body .opening-archive .archive-month-links {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .archive-table-tools {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .archive-table-tools label:first-child {
        grid-column: 1 / -1;
    }

    .archive-scroll-hint {
        display: block;
    }
}

@media (max-width: 480px) {
    body .servers-toolbar {
        grid-template-columns: minmax(0, 1fr);
    }

    body .opening-archive .history-card,
    body .opening-archive .history-hero {
        padding: 20px;
    }

    body .opening-archive .archive-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body .opening-archive .archive-metrics > div:last-child {
        grid-column: 1 / -1;
    }

    body .opening-archive .archive-month-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 16px;
    }

    body .opening-archive .archive-month-links a {
        font-size: 14px;
    }

    body .server-card {
        padding: 20px;
    }

    .archive-table-tools {
        grid-template-columns: minmax(0, 1fr);
    }

    .archive-table-tools label:first-child {
        grid-column: auto;
    }
}

@media (min-width: 1400px) {
    body .opening-archive .archive-breakdowns > section:last-child .archive-distribution {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 32px;
    }

    body .opening-archive .archive-breakdowns > section:last-child .archive-distribution li {
        grid-template-columns: minmax(75px, 1fr) 1fr 36px;
        gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .site-header.is-compact .header-controls {
        transition: none;
    }
}
