/*
 * Shared design system for the public content pages (guide, galaxy map,
 * leaderboard). Reproduces the landing page's visual language — same palette,
 * Inter body + monospace eyebrows/labels, the panel-style header chrome
 * (panel-bg + panel-border + blur), light-weight headings in --text-bright —
 * so every sub-page reads as part of the same product as the home page.
 *
 * Lives in public/ (NOT processed/hashed by Vite) so it has a stable
 * `/site-pages.css` URL the generated static guide pages can link safely.
 * The landing page (index.html) keeps its own styles.css and is untouched.
 */

:root {
    --bg: #05070d;
    --panel-bg: rgba(10, 16, 36, 0.88);
    --panel-border: rgba(74, 111, 165, 0.18);
    --text: #cfd8e8;
    --text-dim: #6c7891;
    --text-bright: #e8eef7;
    --accent: #ffb457;
    --accent-hover: #ffcb84;
    --accent-fg: #0a1024;
    --accent-tint: rgba(255, 180, 87, 0.07);
    --signal-cyan: #7fdbff;
    --res-palladium: #d8b774;
    --res-iridium: #b9c7e0;
    --res-credits: #ffb457;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family:
        "Inter",
        -apple-system,
        system-ui,
        sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.12s;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* --- Header chrome: sticky panel mirroring the landing header inner box. --- */

.public-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: min(1000px, calc(100% - 36px));
    margin: 14px auto 0;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    backdrop-filter: blur(6px);
}

.public-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.public-topbar-brand:hover {
    text-decoration: none;
}

.public-topbar-brand img {
    display: block;
    width: 28px;
    height: 28px;
}

.public-topbar-brand span {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 13px;
    font-weight: 600;
}

.public-topbar-cta {
    background: var(--accent);
    color: var(--accent-fg);
    border: 1px solid var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 11px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 3px;
    transition:
        background 0.12s,
        border-color 0.12s;
}

.public-topbar-cta:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    text-decoration: none;
}

/* --- Page body container + typography (mirrors landing section scale). --- */

.public-main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 48px 24px 96px;
}

h1 {
    font-size: clamp(28px, 3.5vw, 44px);
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 20px;
    color: var(--text-bright);
}

h2 {
    font-size: clamp(20px, 2.2vw, 26px);
    font-weight: 300;
    letter-spacing: -0.01em;
    margin: 40px 0 14px;
    color: var(--text-bright);
}

h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 26px 0 8px;
    color: var(--text-bright);
}

p {
    margin: 0 0 16px;
    max-width: 70ch;
}

ul {
    margin: 0 0 16px;
    padding-left: 22px;
}

li {
    margin: 5px 0;
}

strong {
    color: var(--text-bright);
    font-weight: 600;
}

code {
    background: rgba(127, 219, 255, 0.1);
    color: var(--signal-cyan);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: ui-monospace, "JetBrains Mono", monospace;
    font-size: 0.92em;
}

.res-palladium {
    color: var(--res-palladium);
}
.res-iridium {
    color: var(--res-iridium);
}
.res-credits {
    color: var(--res-credits);
}
.val {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

/* --- Guide: sidebar + content grid. --- */

.guide-layout {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 24px 96px;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 56px;
}

.guide-nav {
    position: sticky;
    top: 84px;
    align-self: start;
    font-size: 14px;
}

.nav-group {
    margin-bottom: 22px;
}

.nav-group h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-dim);
    font-family: ui-monospace, "JetBrains Mono", monospace;
    font-weight: 600;
    margin: 0 0 8px;
}

.nav-group ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-group li {
    margin: 2px 0;
}

.nav-group a {
    color: var(--text-dim);
    display: block;
    padding: 4px 10px;
    border-radius: 4px;
}

.nav-group a:hover {
    color: var(--text-bright);
    background: var(--accent-tint);
    text-decoration: none;
}

.nav-group a.active {
    color: var(--accent);
    background: var(--accent-tint);
}

.guide-content {
    min-width: 0;
}

.guide-foot {
    border-top: 1px solid var(--panel-border);
    margin-top: 44px;
    padding-top: 22px;
    color: var(--text-dim);
    font-size: 14px;
}

/* --- Ship-stats table (guide). --- */

.stats {
    border-collapse: collapse;
    margin: 0 0 22px;
    width: 100%;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
}

.stats caption {
    text-align: left;
    font-weight: 600;
    color: var(--text-bright);
    padding: 11px 14px;
    border-bottom: 1px solid var(--panel-border);
}

.stats th,
.stats td {
    text-align: left;
    padding: 9px 14px;
    border-top: 1px solid var(--panel-border);
    font-size: 14px;
}

.stats th {
    color: var(--text-dim);
    font-weight: 500;
    width: 55%;
}

.stats td {
    color: var(--text-bright);
    font-variant-numeric: tabular-nums;
}

/* --- Leaderboard table. --- */

/* Horizontal scroll container so the table can overflow sideways on narrow
 * screens instead of crushing its columns. */
.board-scroll {
    margin-top: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* Evergreen copy under the board/map data, set off from it. */
.section-note {
    margin-top: 40px;
}

.board {
    width: 100%;
    /* Floor so columns stay legible; below this the wrapper scrolls. */
    min-width: 440px;
    border-collapse: collapse;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
}

.board thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-family: ui-monospace, "JetBrains Mono", monospace;
    color: var(--text-dim);
    font-weight: 600;
    border-bottom: 1px solid var(--panel-border);
}

.board tbody td {
    padding: 11px 16px;
    border-top: 1px solid var(--panel-border);
    color: var(--text);
    font-size: 15px;
}

.board .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-bright);
}

/* Empire cell: crest inline before the name. */
.board td.board-name-cell {
    display: flex;
    align-items: center;
    gap: 9px;
}
.board-crest {
    flex: none;
    width: 20px;
    height: 20px;
}

.board .rank {
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    width: 64px;
}

.board tbody tr.is-self {
    background: var(--accent-tint);
}

.board .npc-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: rgba(108, 120, 145, 0.18);
    color: var(--text-dim);
}

.board-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-dim);
}

/* --- Galaxy map viewport. --- */

/* Breakout wrapper: heading + intro stay in the 1000px column
 * (.public-main), but the map widens past it. Topbar and footer keep their
 * own 1000px constraint. Negative top margin pulls the map up under
 * .public-main's 96px bottom padding so the intro-to-map gap reads as one
 * comfortable band. */
.map-bleed {
    margin: -64px auto 0;
}

.map-viewport {
    /* At least 1000px wide; otherwise 80% of the viewport, centred. */
    width: max(1000px, 80vw);
    max-width: 100%;
    margin: 0 auto;
    height: 72vh;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: #0a0e14;
    overflow: hidden;
    position: relative;
    cursor: grab;
    touch-action: none;
}

/* Below the 1000px floor the map can't fit — drop to gutter-width so it
 * never forces horizontal scroll on phones/tablets. */
@media (max-width: 1080px) {
    .map-viewport {
        width: auto;
        margin: 0 16px;
    }
}

.map-viewport.dragging {
    cursor: grabbing;
}

.map-viewport canvas.map-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.map-updated {
    color: var(--text-dim);
    font-size: 13px;
    margin: -8px 0 16px;
    cursor: help;
    width: fit-content;
}

.map-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 15px;
    text-align: center;
    padding: 24px;
}

@media (max-width: 860px) {
    .guide-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .guide-nav {
        position: static;
        max-height: none;
    }
}

/* Footer styling is shared across all public pages — see /footer.css
 * (markup in partials/footer.html). Not duplicated here. */

@media (max-width: 720px) {
    /* Tighten the leaderboard so it fits a phone before the scroll wrapper
     * has to kick in. */
    .board thead th {
        padding: 10px 12px;
        font-size: 10px;
    }
    .board tbody td {
        padding: 9px 12px;
        font-size: 14px;
    }
    .board .rank {
        width: 44px;
    }
    .board .npc-tag {
        margin-left: 6px;
        font-size: 9px;
    }
}
