/* base.css — Reset, rem typography, grid, responsive breakpoints */

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

/* Monospace for callsigns, targets and counters: JetBrains Mono (SIL OFL
   1.1, see /static/fonts/JetBrainsMono-OFL.txt), served locally so it
   looks the same in every browser, online or not. */
@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/JetBrainsMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* The LCD panels (Modem Status, System Information), drawn like a radio's
   display: DSEG7 Classic seven-segment digits for the readouts (SIL OFL
   1.1, see /static/licences/DSEG-LICENSE.txt), Matrix Mono Screen
   5x7 dot-matrix for the callsign, status and names (SIL OFL 1.1,
   /static/fonts/MatrixSans-OFL.txt),
   Oxanium for the printed legends (SIL OFL 1.1, /static/fonts/Oxanium-OFL.txt).
   Latin subsets; the browser fetches each only when a panel shows. */
@font-face {
    font-family: 'DSEG7 Classic';
    src: url('../fonts/DSEG7Classic-Bold.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Matrix Mono Screen';
    src: url('../fonts/MatrixMonoScreen.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Oxanium';
    src: url('../fonts/Oxanium.woff2') format('woff2');
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --ps-font-lcd: 'Oxanium', system-ui, sans-serif;
    --ps-font-lcd-seg: 'DSEG7 Classic', 'Oxanium', monospace;
    --ps-font-lcd-dot: 'Matrix Mono Screen', 'Oxanium', monospace;
    --ps-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

html {
    font-size: 100%; /* Respect user's browser font size */
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ps-text-primary, #1a1a1a);
    background-color: var(--ps-bg-primary, #ffffff);
    min-height: 100vh;
}

/* Links in text (the manual, help and cards): the theme's readable
   accent (4.5:1 on its backgrounds, --ps-accent-text), visited or not;
   the browser's default blue and purple vanish on dark themes. Nav,
   sidebar and button links keep their own styles. */
a {
    color: var(--ps-accent-text, var(--ps-accent, #0d6efd));
    text-underline-offset: 0.15em;
}
/* :where() keeps this at a plain a's weight: a link with a class of its
   own (sidebar, contents, nav) keeps its colour once visited. As a:visited
   it outranked them, and Security in the admin sidebar lit up in the
   accent after a visit to /admin#security (the password change's return). */
a:where(:visited) {
    color: var(--ps-accent-text, var(--ps-accent, #0d6efd));
}
a:hover {
    text-decoration-thickness: 2px;
}

/* Screen-reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicator */
:focus-visible {
    outline: 3px solid var(--ps-accent, #0066cc);
    outline-offset: 2px;
}

/* Responsive grid */
.grid {
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

/* Breakpoints: mobile (<576px), tablet (576-991px), desktop (992px+) */
@media (min-width: 576px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 992px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Touch targets */
button, a, select, input, [role="button"] {
    min-height: 2.75rem; /* 44px at default font size */
}

/* Prevent hash-link scrolling past section headers (accounts for sticky nav) */
h1[id], h2[id], h3[id], h4[id] {
    scroll-margin-top: 4.5rem;
}

/* Footer */
footer[role="contentinfo"] {
    background-color: var(--ps-nav-bg, #212529);
    color: var(--ps-nav-text, #ffffff);
    text-align: center;
    padding: 1.25rem 1rem;
    font-size: 0.8125rem;
    line-height: 1.6;
}

footer[role="contentinfo"] p {
    margin: 0.2rem 0;
}

footer[role="contentinfo"] a {
    color: var(--ps-nav-text, #ffffff);
    text-decoration: underline;
    text-underline-offset: 2px;
    min-height: auto;
}

footer[role="contentinfo"] a:hover {
    opacity: 0.85;
}
