/* Retro screen — a fixed character page scaled to the viewport.
   Colours and metrics come from the theme at runtime (js/titleScreen.js);
   the CRT effects come from /portal/shared/crt-fx.js. */

html, body {
    height: 100%;
    margin: 0;
    background: #000;
    overflow: hidden;
}

.rs-viewport {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#rs-stage {
    transform-origin: center center;
    will-change: transform;
}

/* crt_fx.js appends absolutely-positioned overlays here. */
#rs-screen {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 10px 48px rgba(0, 0, 0, 0.6);
}

#rs-text {
    position: relative;
    padding: 1ch 2ch;
    box-sizing: content-box;
    white-space: pre;
    z-index: 1;
}

#rs-text.pixel-crisp {
    image-rendering: pixelated;
    -webkit-font-smoothing: none;
}

.rs-row {
    min-height: 1em;
}

/* Banner rows stack as solid blocks: at the theme's 1.25 line-height the
   inverse background only paints the content box, leaving white gaps between
   the rows of a glyph. */
.rs-banner {
    line-height: 1;
}

/* Apple ][ inverse video: the phosphor colour as the background. */
.rs-inv {
    background: var(--rs-fg, #33ff33);
    color: var(--rs-bg, #001200);
}

/* Menu hit targets sit inside the character grid, so they must not disturb
   its metrics: no button chrome, no baseline shift. */
.rs-menu-hit {
    all: unset;
    color: inherit;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.rs-selected .rs-menu-hit {
    background: var(--rs-fg, #33ff33);
    color: var(--rs-bg, #001200);
}

.rs-heading {
    font-weight: inherit;
}

.rs-menu-row {
    cursor: pointer;
}

.rs-cursor-block {
    background: var(--rs-cursor, #33ff33);
    animation: rs-blink 0.7s steps(1) infinite;
}

@keyframes rs-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}


/* If the themes cannot load, show the noscript-style fallback instead. */
.rs-failed .rs-viewport { display: none; }
.rs-failed .fallback-content { display: block; }

.fallback-content {
    display: none;
    max-width: 40rem;
    margin: 4rem auto;
    padding: 0 1.5rem;
    color: #33ff33;
    background: #001200;
    font-family: "Courier New", monospace;
}

.fallback-content a { color: #33ff33; }

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

/* Markdown blocks rendered onto the grid. */
.rs-meta {
    opacity: 0.75;
}

.rs-code {
    opacity: 0.9;
}

/* Pager: buttons live inside the character grid, so they must not disturb it. */
.rs-pager-btn {
    all: unset;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.rs-pager-btn:hover:not(.rs-pager-off),
.rs-pager-btn:focus-visible:not(.rs-pager-off) {
    background: var(--rs-fg, #33ff33);
    color: var(--rs-bg, #001200);
}

.rs-pager-off {
    opacity: 0.35;
    cursor: default;
}

/* Graphics-mode masthead: a raster from the machine's own graphics mode,
   scaled with hard pixel edges rather than smoothed. */
.rs-graphic-banner {
    position: relative;
    overflow: visible;
}

.rs-banner-canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
