/* Server directory, server pages and cards (docs/servers.md). Built on the
   site's variables (portfolio.css / theme.css); the card itself reuses the
   homepage's #servers .server-card styles. */

/* ---------- Cards ---------- */

.server-card {
    position: relative;
}

.server-card h3 a,
.server-card h2 a {
    color: inherit;
    text-decoration: none;
}

/* The whole card is the link (the heading's link covers it). */
.server-card h3 a::after,
.server-card h2 a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.server-card:focus-within {
    border-color: var(--accent-bright);
}

.server-card a:focus-visible {
    outline: none;
}

.server-card:has(a:focus-visible) {
    outline: 2px solid var(--accent-bright);
    outline-offset: 3px;
}

.server-card.featured {
    border-color: var(--accent-bright);
}

.server-featured {
    align-self: flex-start;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-bright);
    margin: 0 0 calc(8px * var(--space-scale));
}

.server-card .server-live,
.server-card > .server-status-badge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 calc(12px * var(--space-scale));
    min-height: 1.6em;
}

.server-card .server-status-badge {
    align-self: flex-start;
}

.server-card-players {
    color: var(--text-muted);
    font-size: 0.85em;
}

.server-card.past .server-logo {
    filter: grayscale(0.7);
    opacity: 0.85;
}

.server-status-badge.past,
.server-status-badge.loading,
.server-status-badge.unknown {
    color: var(--text-muted);
}

.server-status-badge.loading::before {
    animation: server-pulse 1.2s ease-in-out infinite;
}

@keyframes server-pulse {
    50% { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
    .server-status-badge.loading::before { animation: none; }
}

.server-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: calc(14px * var(--space-scale)) 0 0;
}

.server-tags li {
    font-size: 0.78em;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ---------- Directory ---------- */

.server-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin: 0 0 calc(28px * var(--space-scale));
}

.server-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.server-filter {
    font: inherit;
    font-size: 0.9em;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
}

.server-filter:hover {
    color: var(--text);
    border-color: var(--accent-bright);
}

.server-filter[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent-bright);
    color: var(--text-strong);
}

.server-filter:focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 2px;
}

.server-group + .server-group {
    margin-top: calc(48px * var(--space-scale));
}

.server-group > h2 {
    font-size: 1.25em;
    margin: 0 0 calc(18px * var(--space-scale));
}

.server-none {
    color: var(--text-muted);
}

.home-servers-more {
    margin: calc(24px * var(--space-scale)) 0 0;
}

.home-servers-more a {
    color: var(--accent-bright);
    font-weight: 600;
}

/* ---------- Server page ---------- */

.server-hero {
    position: relative;
    padding-top: calc(40px * var(--space-scale));
}

.server-banner {
    display: block;
    width: 100%;
    max-height: 340px;
    object-fit: cover;
    margin: calc(-40px * var(--space-scale)) 0 calc(32px * var(--space-scale));
    border-bottom: 1px solid var(--border);
}

.server-back {
    margin: 0 0 calc(20px * var(--space-scale));
}

.server-back a,
.server-more a {
    color: var(--accent-bright);
    font-weight: 600;
}

.server-head {
    display: flex;
    align-items: center;
    gap: calc(22px * var(--space-scale));
    flex-wrap: wrap;
}

.server-head h1 {
    margin: 0 0 4px;
}

.server-tagline {
    color: var(--text-muted);
    margin: 0 0 10px;
    font-size: 1.1em;
}

.server-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface-alt);
    overflow: hidden;
    flex: none;
}

.server-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.server-logo-large {
    width: 112px;
    height: 112px;
    font-size: 2.4em;
    font-weight: 700;
    color: var(--text-muted);
}

.server-hero.past .server-logo-large {
    filter: grayscale(0.7);
}

.server-address {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin: calc(26px * var(--space-scale)) 0 0;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(10px * var(--radius-scale));
    max-width: 640px;
}

.server-address-label {
    color: var(--text-muted);
    font-size: 0.85em;
}

.server-address code {
    font-family: var(--font-mono, monospace);
    font-size: 1.05em;
    color: var(--text-strong);
    overflow-wrap: anywhere;
    flex: 1;
}

.server-players {
    color: var(--text-muted);
    margin: 10px 0 0;
    min-height: 1.4em;
}

.server-closed {
    margin: calc(24px * var(--space-scale)) 0 0;
    padding: 14px 18px;
    border-left: 3px solid var(--text-muted);
    background: var(--surface);
    color: var(--text-muted);
    max-width: 640px;
}

.server-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 36px;
    margin: calc(20px * var(--space-scale)) 0 0;
}

.server-facts div {
    display: flex;
    flex-direction: column;
}

.server-facts dt {
    color: var(--text-muted);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.server-facts dd {
    margin: 2px 0 0;
    font-weight: 600;
}

.server-roles {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 14px;
}

.server-roles li {
    display: flex;
    gap: 12px;
    align-items: baseline;
}

.role-dot {
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--role, var(--accent-bright));
    transform: translateY(1px);
}

.server-roles li.milestone .role-dot {
    border-radius: 2px;
    transform: translateY(1px) rotate(45deg);
}

.server-roles a {
    color: var(--text);
}

.role-type,
.role-dates {
    color: var(--text-muted);
    font-size: 0.9em;
}

.server-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: calc(16px * var(--space-scale));
}

.server-gallery figure {
    margin: 0;
}

.server-gallery a {
    display: block;
    border-radius: calc(10px * var(--radius-scale));
    overflow: hidden;
    border: 1px solid var(--border);
}

.server-gallery a:focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 2px;
}

.server-gallery img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.server-gallery a:hover img {
    transform: scale(1.03);
}

.server-gallery figcaption {
    color: var(--text-muted);
    font-size: 0.88em;
    margin-top: 6px;
}

.server-updates {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.server-updates a {
    color: var(--accent-bright);
    font-weight: 600;
}

.server-updates span {
    display: block;
    color: var(--text-muted);
    font-size: 0.92em;
}

/* ---------- Screenshot viewer ---------- */

.server-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
}

.server-viewer[hidden] {
    display: none;
}

.server-viewer figure {
    margin: 0;
    max-width: min(1200px, 86vw);
    text-align: center;
}

.server-viewer img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: calc(8px * var(--radius-scale));
}

.server-viewer figcaption {
    color: #e6f1f0;
    margin-top: 10px;
}

.server-viewer button {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.6em;
    line-height: 1;
    cursor: pointer;
    flex: none;
}

.server-viewer button:hover,
.server-viewer button:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    outline: 2px solid var(--accent-bright);
}

.server-viewer .server-viewer-close {
    position: absolute;
    top: 16px;
    right: 16px;
}

body.server-viewer-open {
    overflow: hidden;
}

@media (max-width: 600px) {
    .server-viewer {
        padding: 60px 8px 8px;
    }

    .server-viewer .server-viewer-prev,
    .server-viewer .server-viewer-next {
        position: absolute;
        bottom: 16px;
    }

    .server-viewer .server-viewer-prev { left: 16px; }
    .server-viewer .server-viewer-next { right: 16px; }

    .server-logo-large {
        width: 84px;
        height: 84px;
    }
}

/* Kinds of server (Minecraft, Discord, other communities). */
.server-kind {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 9px;
    margin: 0 0 calc(8px * var(--space-scale));
}

.server-kind.kind-discord {
    color: #9aa4ff;
    border-color: rgba(88, 101, 242, 0.55);
}

.server-head .server-kind {
    vertical-align: middle;
    margin: 0 8px 0 0;
}

.server-status-badge.discord::before {
    background: #5865f2;
}

.server-join {
    margin: calc(26px * var(--space-scale)) 0 0;
}
