/* The colours are var(--…) from /_shared/themes.css; the header buttons and
   the theme toggle come from /_shared/theme.css. */

:root {
    --grass: #7cb342;
}

/* Elements below set their own display; hidden still wins. */
[hidden] {
    display: none !important;
}

/* Section links land below the sticky top bar, not under it. */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 116px;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;

    background: var(--background);
    border-bottom: 1px solid var(--border);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 12px 20px 8px;
}

/* The section links: one row, centred over the page; on a phone it scrolls
   sideways. The one for the section on screen is filled in (minecraft.js). */
.section-nav {
    display: flex;
    gap: 6px;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
    display: none;
}

.section-nav a {
    flex: none;
    padding: 4px 12px;

    border: 1px solid var(--border);
    border-radius: 999px;

    color: var(--text-soft);
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
}

.section-nav a:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.section-nav a[aria-current="true"] {
    border-color: var(--text);
    background: var(--text);
    color: var(--background);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    color: var(--text);
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
}

.brand .icon {
    width: 24px;
    height: 24px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* In this header, the toggle sits in the row instead of floating. */
.site-header .theme-toggle {
    position: static;
}

.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 32px 16px 64px;
    line-height: 1.6;
}

a {
    color: var(--accent);
}

h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 6vw, 40px);
    line-height: 1.15;
}

h2 {
    margin: 0 0 12px;
    font-size: 22px;
}

h3 {
    margin: 28px 0 8px;
    font-size: 17px;
}

.lead {
    margin: 0 0 20px;
    color: var(--text-soft);
    font-size: 18px;
}

code,
kbd,
pre {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.92em;
}

code {
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--surface-hover);
}

pre {
    margin: 8px 0;
    overflow-x: auto;
}

pre code {
    display: block;
    padding: 8px 12px;
}

kbd {
    display: inline-block;
    min-width: 1.8em;
    padding: 1px 6px;

    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;

    background: var(--surface);
    text-align: center;
}

/* The address, big enough to read off a second screen while typing it in. */
.address {
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    align-items: center;
    gap: 10px 14px;

    padding: 16px 18px;

    border: 1px solid var(--border);
    border-left: 4px solid var(--grass);
    border-radius: 12px;

    background: var(--surface);
}

/* The address, and beside it whether the server is up right now. */
.hero-row {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 12px;
    margin: 0 0 20px;
}

.hero-row > :only-child {
    grid-column: 1 / -1;
}

.live {
    display: flex;
    flex-direction: column;
    gap: 4px;

    padding: 16px 18px;

    border: 1px solid var(--border);
    border-left: 4px solid var(--state);
    border-radius: 12px;

    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}

.live:hover {
    background: var(--surface-hover);
}

.live .address-label {
    flex-basis: auto;
}

.live-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
}

.live .pulse {
    width: 56px;
    height: 20px;
}

.live-more {
    color: var(--text-soft);
    font-size: 13px;
}

.address-label {
    flex-basis: 100%;
    color: var(--text-soft);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.address code {
    padding: 0;
    background: none;
    font-size: clamp(20px, 5vw, 26px);
    font-weight: 600;
    word-break: break-all;
}

.facts {
    margin: 0;
    padding: 0;
    list-style: none;
}

.facts li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.facts li:last-child {
    border-bottom: none;
}

.facts strong {
    display: inline-block;
    min-width: 72px;
    margin-right: 6px;
}

.card {
    margin-top: 28px;
    padding: 22px 22px 18px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--surface);
    box-shadow: var(--shadow);
}

.steps {
    margin: 0;
    padding-left: 22px;
}

.steps li {
    margin-bottom: 10px;
    padding-left: 4px;
}

.note {
    color: var(--text-soft);
    font-size: 14px;
}

.commands {
    width: 100%;
    border-collapse: collapse;
}

.commands th {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
}

.commands th,
.commands td {
    padding: 8px 10px 8px 0;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.commands td:first-child {
    width: 38%;
}

.download {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin: 18px 0 4px;
}

.button-primary {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 18px;

    border-radius: 10px;

    background: var(--accent);
    color: var(--background);
    font-weight: 600;
    text-decoration: none;
}

.button-primary:hover {
    filter: brightness(1.08);
}

.button-primary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.download-meta {
    color: var(--text-soft);
    font-size: 14px;
}

.mods {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 16px;
    margin: 0;
}

.mods dt {
    font-weight: 600;
}

.mods dd {
    margin: 0;
}

/* The server's status: a heartbeat and a line, who is on, totals, and a
   table. The heartbeat is the passwords hub's: a trace that sweeps along it
   while the server answers, a flat red line while it doesn't. */
.status-state {
    --state: var(--text-soft);
}

.status-state[data-state="online"] {
    --state: var(--grass);
}

.status-state[data-state="offline"] {
    --state: var(--danger);
}

.status-state:not([data-state="online"]) .pulse-up,
.status-state:not([data-state="offline"]) .pulse-down {
    display: none;
}

.pulse {
    flex: none;
    width: 80px;
    height: 28px;
    overflow: visible;
}

.pulse path {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pulse-up .pulse-track {
    stroke: color-mix(in srgb, var(--state) 25%, transparent);
}

.pulse-up .pulse-trace {
    stroke: var(--state);
    stroke-dasharray: 30 100;
    animation: pulse-sweep 1.8s linear infinite;
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--state) 60%, transparent));
}

.pulse-down .pulse-track {
    stroke: var(--state);
    animation: flatline 2s ease-in-out infinite;
}

@keyframes pulse-sweep {
    from { stroke-dashoffset: 30; }
    to { stroke-dashoffset: -100; }
}

@keyframes flatline {
    50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .pulse-up .pulse-trace {
        animation: none;
        stroke-dasharray: none;
    }

    .pulse-down .pulse-track {
        animation: none;
    }
}

.status-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}

.status-head h2 {
    margin: 0;
}

.status-meta {
    color: var(--text-soft);
    font-size: 14px;
}

.online-now {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.online-label {
    color: var(--text-soft);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.online-names {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.online-names li {
    padding: 2px 10px;

    border: 1px solid var(--border);
    border-radius: 999px;

    background: var(--background);
    font-weight: 600;
}

.totals {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 18px 0 4px;
}

.totals div {
    padding: 10px 12px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--background);
}

.totals dt {
    color: var(--text-soft);
    font-size: 13px;
}

.totals dd {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.table-scroll {
    overflow-x: auto;
}

.players {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.players th {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 500;
}

.players th,
.players td {
    padding: 8px 14px 8px 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
}

.players th:first-child,
.players td:first-child {
    text-align: left;
    font-weight: 600;
}

.players .is-online::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 6px;
    vertical-align: middle;

    border-radius: 50%;
    background: var(--grass);
}

@media (max-width: 600px) {
    .site-header {
        padding: 10px 16px 8px;
    }

    .hero-row {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 18px 16px 14px;
    }

    .commands td:first-child {
        width: auto;
    }

    .commands tr {
        display: flex;
        flex-direction: column;
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
    }

    .commands thead {
        display: none;
    }

    .commands td {
        padding: 2px 0;
        border: none;
    }

    .mods {
        grid-template-columns: 1fr;
    }

    .mods dd {
        margin-bottom: 8px;
    }

    .totals {
        grid-template-columns: repeat(2, 1fr);
    }
}
