/* PiSpace hub. Plain CSS, no build step. Colours are tokens on :root. */

:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #eef1f6;
    --text: #18202e;
    --muted: #526077;
    --line: #dbe1ea;
    --accent: #1d3f8f;
    --accent-2: #2f5fd0;
    --accent-soft: #e6ecfa;
    --good: #1f7a4d;
    --bad: #b3261e;
    --focus: #f0b429;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --max: 1160px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f131a;
        --surface: #161c26;
        --surface-2: #1d2532;
        --text: #e7ebf2;
        --muted: #9aa6ba;
        --line: #2a3445;
        --accent: #8fb0ff;
        --accent-2: #a9c2ff;
        --accent-soft: #1c2740;
        --good: #6fcf97;
        --bad: #ff8a80;
        --shadow: none;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0f131a;
    --surface: #161c26;
    --surface-2: #1d2532;
    --text: #e7ebf2;
    --muted: #9aa6ba;
    --line: #2a3445;
    --accent: #8fb0ff;
    --accent-2: #a9c2ff;
    --accent-soft: #1c2740;
    --good: #6fcf97;
    --bad: #ff8a80;
    --shadow: none;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 var(--font);
    overflow-wrap: break-word;
}

img { max-width: 100%; height: auto; }

a { color: var(--accent-2); text-underline-offset: 2px; }
a:hover { color: var(--accent); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); letter-spacing: -.01em; }
h2 { font-size: 1.35rem; margin-top: 1.6em; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Network strip */
.network { background: var(--accent); color: #fff; font-size: .85rem; }
:root[data-theme="dark"] .network { background: #0b1d4a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .network { background: #0b1d4a; } }
.network__inner { display: flex; gap: 10px; align-items: center; min-height: 34px; overflow-x: auto; scrollbar-width: none; }
.network__label { opacity: .8; white-space: nowrap; }
.network ul { display: flex; gap: 14px; list-style: none; margin: 0; padding: 0; }
.network a { color: #fff; text-decoration: none; white-space: nowrap; }
.network a:hover { text-decoration: underline; }

/* Header */
.header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header__inner { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.nav a { color: var(--text); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.is-active { border-color: var(--accent-2); }
.search { display: flex; margin-left: auto; min-width: 0; }
.search input { width: 220px; max-width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; background: var(--bg); color: var(--text); font: inherit; }
.search button, .button { padding: 8px 14px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; cursor: pointer; border-radius: 0 8px 8px 0; }
:root[data-theme="dark"] .search button, :root[data-theme="dark"] .button { color: #0f131a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .search button, :root:not([data-theme="light"]) .button { color: #0f131a; } }
.button { border-radius: 8px; display: inline-block; text-decoration: none; }
.button:hover { color: #fff; filter: brightness(1.1); }
.button--ghost { background: transparent; color: var(--accent-2); }
.theme { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; width: 38px; height: 38px; cursor: pointer; font-size: 1.1rem; }

@media (max-width: 760px) {
    .header__inner { gap: 10px 12px; }
    .brand { order: 1; }
    .theme { order: 2; margin-left: auto; }
    .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 16px; }
    .nav a { white-space: nowrap; }
    .search { order: 4; margin-left: 0; flex: 1 1 100%; }
    .search input { width: 100%; flex: 1; }
}

/* Breadcrumbs */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 14px auto 0; padding: 0; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.crumbs a { color: var(--muted); }

.main { padding-top: 20px; padding-bottom: 56px; }

/* Shared blocks */
.lead { font-size: 1.12rem; color: var(--muted); max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.prose { max-width: 72ch; }
.prose h2 { font-size: 1.25rem; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .35em; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid--wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.grid--small { grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin-bottom: .3em; }
.card p:last-child { margin-bottom: 0; }
.card--link { display: block; color: inherit; text-decoration: none; }
.card--link:hover { border-color: var(--accent-2); }
.card--link:hover h3 { color: var(--accent-2); }
.card__meta { font-size: .85rem; color: var(--muted); }

.tag { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 9px; }

.hero { padding: 26px 0 8px; }
.hero h1 { max-width: 22ch; }
.stats { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 18px 0 6px; padding: 0; list-style: none; }
.stats strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.stats span { color: var(--muted); font-size: .9rem; }

.section { margin-top: 40px; }
.section__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.section__head h2 { margin-top: 0; }

/* Key figures */
.figures { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); margin: 16px 0; }
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.figure__label { font-size: .88rem; color: var(--muted); }
.figure__value { font-size: 1.45rem; font-weight: 700; line-height: 1.25; margin: 2px 0; }
.figure__meta { font-size: .8rem; color: var(--muted); }
.figure__rank { font-size: .85rem; }

.facts { padding-left: 1.2em; max-width: 75ch; }
.facts li { margin-bottom: .4em; }

/* Site link list */
.site-links { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.site-link { display: flex; flex-direction: column; gap: 4px; }
.site-link a { font-weight: 600; }
.site-link__site { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.up { color: var(--good); }
.down { color: var(--bad); }

.columns { columns: 3 220px; column-gap: 28px; }
.columns > div { break-inside: avoid; margin-bottom: 18px; }
.columns h3 { font-size: 1rem; margin-bottom: .3em; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { margin: 2px 0; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

.pager { display: flex; gap: 12px; margin-top: 18px; }

.notice { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; }
.error { color: var(--bad); }

/* Forms (installer and admin) */
.form { max-width: 560px; }
.form label { display: block; font-weight: 600; margin: 12px 0 4px; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number], .form input[type=url] {
    width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit;
}
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 16px; margin: 16px 0; }
.form .button { margin-top: 16px; }
.check { display: flex; gap: 8px; align-items: center; }
.ok { color: var(--good); }
.inline { display: inline; }

/* Footer */
.footer { background: var(--surface); border-top: 1px solid var(--line); padding: 32px 0 18px; font-size: .93rem; }
.footer__grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.footer h2 { font-size: .95rem; margin: 0 0 8px; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin: 4px 0; }
.footer a { color: var(--text); }
.footer__note { color: var(--muted); margin-top: 18px; font-size: .85rem; }
