/* Site styles. Every value comes from tokens.css. */

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-body);
    line-height: 1.6;
    background: var(--color-bg);
    color: var(--color-text);
}

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

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Secondary text: the same type as the body, only quieter. No small caps, no mono labels. */
.readout {
    color: var(--color-text-muted);
}

/* ---- Navigation ---- */

.navbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-6);
    min-height: var(--nav-height);
    padding: var(--space-3) var(--page-gutter);
    background: var(--nav-bg);
    color: var(--nav-text);
}

.navbar-brand {
    font-weight: 600;
    text-decoration: none;
    color: var(--nav-text);
}

.navbar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-6);
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: var(--nav-text-muted);
    transition: color var(--duration-fast) var(--ease-out);
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--color-accent);
}

/* ---- Ordinary pages (the tools' own pages) ---- */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-8) var(--page-gutter);
}

/* ---- The rocket game's scene and its overlays ---- */

.room {
    position: relative;
}

.scene {
    position: relative;
    height: calc(100vh - var(--nav-height));
    min-height: 420px;
    overflow: hidden;
    background: var(--void);
}

.scene[hidden] {
    display: none;
}

#scene-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

.hud {
    position: absolute;
    z-index: 2;
    left: var(--page-gutter);
    right: var(--page-gutter);
    bottom: var(--space-6);
    color: var(--hud-text);
    pointer-events: none;
}

.hud .readout {
    color: var(--hud-text-muted);
}

.hud-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
}

#hud-section {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 900;
    font-stretch: 125%;
    line-height: 0.85;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.hud-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-2);
    text-align: right;
}

/* ---- Rocket game (the solar system page) ---- */

/* The game then fades in, once it has a picture to show. */
.game .scene {
    opacity: 0;
    transition: opacity 1200ms linear;
}

.game .scene.ready {
    opacity: 1;
}

.game #scene-canvas {
    cursor: crosshair;
}

.game-launch {
    pointer-events: auto;
    min-height: 44px;
    padding: var(--space-2) var(--space-6);
    border: 1px solid var(--color-accent);
    background: var(--color-accent);
    color: var(--color-on-accent);
    font: inherit;
    cursor: pointer;
}

.game-launch[hidden] {
    display: none;
}

/* The address a planet leads to, shown under it while the pointer is on it.
   rocket.js sets left and top. */
.game-link {
    position: absolute;
    z-index: 2;
    padding: var(--space-1) var(--space-2);
    background: var(--void);
    border: 1px solid var(--hud-text-muted);
    color: var(--hud-text);
    transform: translate(-50%, 8px);
    white-space: nowrap;
    pointer-events: none;
}

.game-link[hidden] {
    display: none;
}

/* ---- Publication record (its own page and the home page's card) ---- */

.publication {
    max-width: var(--measure);
}

.publication-title {
    margin: 0 0 var(--space-4);
    font-weight: 300;
    font-size: clamp(1.75rem, 3.6vw, 3rem);
    line-height: 1.1;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.publication-authors,
.publication-meta {
    margin: 0 0 var(--space-2);
    color: var(--color-text-muted);
}

.publication-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-6);
    margin: var(--space-4) 0 0;
}

.me {
    color: var(--color-text);
    font-weight: 700;
}

.publication h2 {
    margin: var(--space-12) 0 var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-rule);
    font-weight: 300;
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.publication-figure {
    margin: var(--space-8) 0 0;
}

/* The drawing of the abstract (art.py): rings in the page's ink, key words in its accent. */
.pub-art {
    display: block;
    width: 100%;
    aspect-ratio: 8 / 5;
    background: var(--color-bg);
    border: 1px solid var(--color-rule);
}

.pub-art circle {
    fill: none;
    stroke: var(--color-text);
}

.pub-art .ring {
    opacity: var(--o);
}

.pub-art .key {
    stroke: var(--color-accent-text);
}

.pub-art .glow {
    stop-color: var(--color-surface);
}

.pub-art .centre {
    stroke: none;
}

.pub-art .dot {
    fill: var(--color-text);
    stroke: none;
}

.publication-figure figcaption {
    margin-top: var(--space-3);
    color: var(--color-text-muted);
}

.prose pre {
    padding: var(--space-4);
    overflow-x: auto;
    background: var(--color-surface);
    font-family: var(--font-readout);
    font-size: 0.875rem;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
