/*
 * branchthroughzero.co.uk, RPCEmu Extended.
 *
 * Quiet and open. Paper ground, a lot of air, very few lines. Content sits in
 * a comfortable measure with generous space between sections rather than in
 * bordered grids, which is what made the earlier version read as blocky.
 *
 * Type is Archivo at normal width: sentence case, weight 600 for headings, no
 * uppercase display. IBM Plex Mono is kept for the things that really are
 * data, which is version numbers, commands and hashes, and nothing else.
 *
 * Every text and boundary colour is checked against WCAG 2.2 AA by
 * tests/run.php, which reads the values out of this file.
 */

@font-face {
    font-family: 'Archivo';
    src: url('/assets/fonts/archivo.woff2') format('woff2-variations');
    font-weight: 400 700;
    font-stretch: 88% 105%;
    font-display: swap;
}

@font-face {
    font-family: 'Plex Mono';
    src: url('/assets/fonts/plexmono-0.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Plex Mono';
    src: url('/assets/fonts/plexmono-1.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}

:root {
    /* Soft greys with an Acorn green. The green is the accent and the link
       colour; the greys are very slightly warm-neutral so screenshots of a
       grey RISC OS desktop sit in the page rather than fighting it. */
    --paper:      #f2f4f0;
    --surface:    #fbfcf9;
    --ink:        #1d2420;
    --ink-muted:  #586159;
    --rule:       #dde3dc;
    --tint:       #e7eee7;

    --accent:     #2f6b41;
    --accent-hi:  #265735;
    --accent-ink: #ffffff;
    --edge:       #2b6340;
    --deep:       #1b211d;
    --deep-ink:   #8fc79f;
    --deep-text:  #a9b3aa;
    --deep-rule:  #333f36;
    /* The green button sits on both grounds. Its fill is only 2.6:1 against
       the dark bars, so on those it takes a lighter border to stay a
       distinguishable control. */
    --btn-edge:   #6aa77f;

    --page:   1400px;
    --measure: 58rem;

    --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --mono: 'Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.7;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.012em; line-height: 1.2; }
p, ul, ol { margin: 0; padding: 0; }
a { color: var(--edge); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
/* An ink ring on a dark green button is only 2.5:1, so the button gets a
   white one, which is 6.4:1 against the same fill. */
.btn:focus-visible { outline-color: #fff; outline-offset: 2px; }
img { display: block; max-width: 100%; height: auto; }

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 clamp(1.25rem, 5vw, 2.5rem); }

.skip { position: absolute; left: -9999px; }
.skip:focus {
    position: static; display: inline-block; margin: 0.5rem 1rem;
    padding: 0.5rem 0.9rem; background: var(--surface); border: 2px solid var(--ink);
}

.eyebrow {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

/* ------------------------------------------------------------------- nav */

.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--deep);
    color: var(--paper);
    border-bottom: 1px solid var(--deep-rule);
}
.nav :focus-visible { outline-color: #fff; }

.nav .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
    min-height: 4rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--paper);
    white-space: nowrap;
}
.brand span { font-weight: 400; color: var(--deep-text); }

/* The acorn is a dark green mark on transparency: its average is 2.7:1
   against this bar and its darkest parts 1.1:1, so on a dark ground it
   disappears. It gets a light plate to sit on rather than being recoloured,
   which would be somebody else's artwork altered. */
.brand img {
    background: var(--paper);
    border-radius: 6px;
    padding: 3px;
    box-sizing: content-box;
}

.nav nav { display: none; margin-left: auto; gap: 1.6rem; }
.nav nav a {
    color: var(--deep-text);
    text-decoration: none;
    font-size: 0.95rem;
}
.nav nav a:hover { color: var(--paper); }

.nav .btn-small { margin-left: auto; }

/* --------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    background: var(--accent);
    border: 1px solid var(--accent-hi);
    color: var(--accent-ink);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: var(--accent-hi); }

.btn-small { min-height: 40px; padding: 0.35rem 1rem; font-size: 0.92rem; }

/* On the dark bars the fill alone is not enough of a boundary. */
.nav .btn, .foot .btn { border-color: var(--btn-edge); }

.quiet { font-weight: 500; }

/* ------------------------------------------------------------------ hero */

.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem); }

.hero-grid {
    display: grid;
    gap: clamp(2rem, 5vw, 4.5rem);
    grid-template-columns: 1fr;
    align-items: center;
}

.hero-shot { margin: 0; }
.hero-shot img {
    width: 100%;
    max-width: 30rem;
    border-radius: 8px;
    box-shadow: 0 20px 50px -24px rgb(29 36 32 / 0.5);
}
.hero-shot figcaption {
    margin-top: 0.85rem;
    max-width: 30rem;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.hero h1 {
    font-size: clamp(2.1rem, 4vw, 3.15rem);
    letter-spacing: -0.022em;
    text-wrap: balance;
}

.hero .lede {
    margin-top: 1.25rem;
    max-width: 54ch;
    font-size: clamp(1.1rem, 1.5vw, 1.3rem);
    color: var(--ink-muted);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2rem;
}

.hero .under {
    margin-top: 1.5rem;
    max-width: 68ch;
    font-size: 0.95rem;
    color: var(--ink-muted);
}

/* ------------------------------------------------------------ screenshots */

.shot { margin: 0; }

.shot img {
    width: 100%;
    border: 1px solid var(--rule);
    border-radius: 6px;
}

.shot figcaption {
    margin-top: 0.85rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--ink-muted);
}

.shot.lead { margin-top: clamp(2.5rem, 6vw, 4rem); }
.shot.lead img { box-shadow: 0 24px 60px -30px rgb(34 32 27 / 0.45); }

/* --------------------------------------------------------------- sections */

.band { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.band.hairline { border-top: 1px solid var(--rule); }

.head { max-width: var(--measure); }
.head h2 {
    margin-top: 0.6rem;
    font-size: clamp(1.6rem, 2.8vw, 2.15rem);
    letter-spacing: -0.018em;
}
.head p { margin-top: 0.9rem; color: var(--ink-muted); }

/* ------------------------------------------------------------- downloads */

.dl-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.6rem 1.25rem;
    margin-top: 1.75rem;
}
.dl-head .v { font-family: var(--mono); font-weight: 600; font-size: 1.1rem; }
.dl-head .when, .dl-head a { font-size: 0.9rem; color: var(--ink-muted); }
.dl-head a { margin-left: auto; color: var(--edge); }

.plats {
    display: grid;
    gap: clamp(1.5rem, 3vw, 2.75rem);
    grid-template-columns: 1fr;
    margin-top: 1.75rem;
}

.plat h3 { font-size: 1rem; }

.plat ul { list-style: none; margin-top: 0.85rem; display: grid; gap: 0.65rem; }
.plat li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.6rem; }
.plat a { font-weight: 500; }
.plat .meta { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-muted); }

/* A screen-reader-only caption: the table needs a name, the design does not
   need it drawn. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Wide content scrolls inside its own box rather than pushing the page
   sideways, which is what tests/layout.sh checks for. */
.table-scroll {
    margin-top: 1.75rem;
    overflow-x: auto;
}

.dl {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.97rem;
}

.dl thead th {
    padding: 0 0.9rem 0.6rem;
    border-bottom: 1px solid var(--rule);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-muted);
    text-align: left;
    white-space: nowrap;
}

.dl tr.group th {
    padding: 1.4rem 0.9rem 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    color: var(--ink);
}

.dl tbody tr:not(.group) th,
.dl tbody td {
    padding: 0.7rem 0.9rem;
    border-top: 1px solid var(--rule);
    text-align: left;
    vertical-align: baseline;
    font-weight: 400;
}

.dl tbody tr:not(.group) th a { font-weight: 500; white-space: nowrap; }

.dl .num { text-align: right; font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
.dl thead .num { text-align: right; }

.dl .file {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--ink-muted);
    white-space: nowrap;
}

.dl tbody tr:not(.group):hover { background: var(--tint); }

/* The first cell of each row is a heading, so it should not pick up the
   left padding twice at the table edge. */
.dl th:first-child, .dl td:first-child { padding-left: 0; }
.dl th:last-child, .dl td:last-child { padding-right: 0; }

/* ------------------------------------------------------- compatibility */

/* The category index. Enough to see the shape of the catalogue at a glance
   and jump into it. */
.jump {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2rem;
}
.jump a {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.88rem;
    text-decoration: none;
    color: var(--ink);
}
.jump a:hover { border-color: var(--accent); background: var(--tint); }
.jump a span { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-muted); }

.compat-cat {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-top: clamp(2.5rem, 5vw, 3.5rem);
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
    font-size: 1.2rem;
    scroll-margin-top: 5rem;
}
.compat-cat .count { font-family: var(--mono); font-size: 0.8rem; font-weight: 400; color: var(--ink-muted); }

.compat td, .compat th { vertical-align: top; }
.compat tbody th { min-width: 11rem; }
.compat .pub { display: block; font-size: 0.8rem; color: var(--ink-muted); font-weight: 400; }
.compat .yr { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-muted); white-space: nowrap; }

/* Filled and empty stars. The empty ones are outlined rather than merely
   paler, so the rating is not carried by a shade alone. */
.compat .stars { white-space: nowrap; }
.compat .stars b { color: var(--accent); font-weight: 400; }
.compat .stars i {
    color: transparent;
    -webkit-text-stroke: 1px var(--rule);
    font-style: normal;
}
.compat .stars .n { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-muted); margin-left: 0.3rem; }
.compat .unrated { font-size: 0.85rem; color: var(--ink-muted); white-space: nowrap; }

.compat .notes { min-width: 20rem; white-space: normal; font-size: 0.9rem; color: var(--ink-muted); }
.compat .notes .who { display: block; margin-top: 0.2rem; font-size: 0.78rem; }
.compat .notes .hint { font-style: italic; }
.compat .act a { font-size: 0.82rem; white-space: nowrap; }

/* ------------------------------------------------------------- the form */

.tally {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--ink-muted);
}
.tally strong { font-family: var(--mono); font-size: 1.35rem; font-weight: 600; color: var(--ink); }
.tally span { display: flex; align-items: baseline; gap: 0.4rem; }

.alert {
    margin-top: 1.75rem;
    padding: 0.9rem 1.1rem;
    max-width: var(--measure);
    background: var(--tint);
    border-left: 3px solid var(--accent);
    font-size: 0.95rem;
}

.report { max-width: 38rem; margin-top: 2.5rem; }

.field { display: block; margin-top: 1.6rem; border: 0; padding: 0; }
.field > label, .field legend { display: block; font-weight: 600; margin-bottom: 0.4rem; }

.field input[type="text"], .field textarea {
    display: block;
    width: 100%;
    padding: 0.6rem 0.7rem;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--ink-muted);
    border-radius: 6px;
}
.field input[type="text"]:focus-visible, .field textarea:focus-visible { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 6rem; }

.field .hint { display: block; margin-top: 0.35rem; font-size: 0.85rem; color: var(--ink-muted); }
.field .err { display: block; margin-top: 0.35rem; font-size: 0.88rem; font-weight: 600; color: var(--edge); }

/* The rating: five real radios, each with its own label, so a keyboard and a
   screen reader both get a plain list of choices. */
.choice { display: block; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice label {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.7rem;
    margin-top: 0.3rem;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    font-size: 0.95rem;
}
.choice label:hover { border-color: var(--accent); }
.choice input:checked + label { border-color: var(--accent); background: var(--tint); font-weight: 600; }
.choice input:focus-visible + label { outline: 3px solid var(--ink); outline-offset: 2px; }

.choice .rs { white-space: nowrap; }
.choice .rs b { color: var(--accent); font-weight: 400; }
.choice .rs i { color: transparent; -webkit-text-stroke: 1px var(--rule); font-style: normal; }

.pair { display: grid; gap: 0 1.25rem; grid-template-columns: 1fr; }

/* The honeypot. Off-screen rather than display:none, because some robots
   skip anything that is hidden. */
.trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

button.btn { cursor: pointer; font-family: inherit; }

.note {
    margin-top: 2.25rem;
    max-width: var(--measure);
    font-size: 0.95rem;
    color: var(--ink-muted);
}

/* ---------------------------------------------------------- feature rows */

.row {
    display: grid;
    gap: clamp(1.75rem, 4vw, 4rem);
    grid-template-columns: 1fr;
    align-items: center;
    padding-top: clamp(2.5rem, 6vw, 4.5rem);
}

.row-text { max-width: 48ch; }
.row-text h2 { margin-top: 0.6rem; font-size: clamp(1.5rem, 2.4vw, 1.95rem); }
.row-text p { margin-top: 0.9rem; color: var(--ink-muted); }
.row-text .go { display: inline-block; margin-top: 1.1rem; font-weight: 500; }

/* -------------------------------------------------------------- features */

.cards {
    display: grid;
    gap: clamp(1.75rem, 3.5vw, 2.75rem);
    grid-template-columns: 1fr;
    margin-top: 2.5rem;
}

.card h3 { font-size: 1.05rem; }
.card p { margin-top: 0.55rem; font-size: 0.97rem; color: var(--ink-muted); }
.card a { display: inline-block; margin-top: 0.7rem; font-size: 0.92rem; font-weight: 500; }

.also { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.also ul {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem 2.5rem;
    margin-top: 1rem;
    font-size: 0.97rem;
}

/* ------------------------------------------------------------ networking */

.diagram {
    display: block;
    width: 100%;
    max-width: 860px;
    margin: clamp(2rem, 4vw, 3rem) auto 0;
    height: auto;
    font-family: var(--mono);
}
.diagram .group { fill: none; stroke: var(--rule); stroke-width: 1; stroke-dasharray: 4 4; }
.diagram .node  { fill: var(--surface); stroke: var(--rule); stroke-width: 1.5; }
.diagram .node.wide { fill: var(--tint); stroke: var(--accent); }
.diagram .wire  { fill: none; stroke: var(--edge); stroke-width: 1.5; }
.diagram .arrow { marker-end: url(#tip); }
.diagram .ttl   { fill: var(--ink); font-size: 17px; font-weight: 600; }
.diagram .sub   { fill: var(--ink-muted); font-size: 13px; }
.diagram .cap   { fill: var(--ink-muted); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; }
.diagram .cap.left { fill: var(--edge); }

.net-paths {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(1.75rem, 3.5vw, 2.75rem);
    margin-top: clamp(2.5rem, 5vw, 3.5rem);
}
.net-path h3 { margin-top: 0.5rem; font-size: 1.05rem; }
.net-path p { margin-top: 0.55rem; font-size: 0.97rem; color: var(--ink-muted); }
.net-path a { display: inline-block; margin-top: 0.7rem; font-size: 0.92rem; font-weight: 500; }

/* --------------------------------------------------------------- tooling */

.tool-grid {
    display: grid;
    gap: clamp(1.75rem, 4vw, 3.5rem);
    grid-template-columns: 1fr;
    margin-top: 2.25rem;
    align-items: start;
}

.tool-links { list-style: none; display: grid; gap: 0.55rem; margin-top: 1.5rem; font-size: 0.97rem; }

.term {
    background: var(--deep);
    border-radius: 8px;
    overflow-x: auto;
}
.term dl { margin: 0; padding: 1.35rem 1.5rem; font-family: var(--mono); font-size: 0.84rem; line-height: 1.6; }
.term dt { color: var(--paper); white-space: pre; }
.term dt::before { content: "$ "; color: var(--deep-ink); }
.term dd { margin: 0.1rem 0 1.1rem; color: #96a598; }
.term dd::before { content: "# "; }
.term dd:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ news */

.news { display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: 1fr; margin-top: 2.25rem; }
.news h3 { font-size: 1rem; }
.news ul { list-style: none; margin-top: 1rem; }
.news li { padding: 0.75rem 0; }
.news li + li { border-top: 1px solid var(--rule); }

.commits a { color: var(--ink); text-decoration: none; font-weight: 500; }
.commits a:hover { text-decoration: underline; }
.commits .sub { display: block; margin-top: 0.2rem; font-family: var(--mono); font-size: 0.76rem; color: var(--ink-muted); }
.commits .sub b { color: var(--edge); font-weight: 600; }

.releases li { display: flex; align-items: baseline; gap: 0.75rem; }
.releases a { font-family: var(--mono); font-weight: 600; }
.releases .when { margin-left: auto; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-muted); }

.more { margin-top: 1.1rem; font-size: 0.92rem; font-weight: 500; }

/* --------------------------------------------------------------- started */

.steps { list-style: none; counter-reset: step; display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); grid-template-columns: 1fr; margin-top: 2.5rem; }
.steps li { counter-increment: step; }
.steps h3 { font-size: 1rem; }
.steps h3::before {
    content: counter(step) ".";
    margin-right: 0.5rem;
    font-family: var(--mono);
    color: var(--edge);
}
.steps p { margin-top: 0.5rem; font-size: 0.97rem; color: var(--ink-muted); }

/* ---------------------------------------------------------------- footer */

.foot {
    background: var(--deep);
    color: var(--paper);
    padding: clamp(3rem, 6vw, 4.5rem) 0;
    font-size: 0.95rem;
}
.foot a { color: var(--deep-ink); }
.foot :focus-visible { outline-color: #fff; }
.foot-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
.foot h2 { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--deep-text); margin-bottom: 0.75rem; }
.foot ul { list-style: none; display: grid; gap: 0.45rem; }
.foot p { color: var(--deep-text); }
.foot p + p { margin-top: 0.6rem; }

.colophon { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--deep-rule); color: var(--deep-text); font-size: 0.9rem; }
.colophon p + p { margin-top: 0.6rem; }

/* ------------------------------------------------------------ wider views */

@media (min-width: 46em) {
    .pair { grid-template-columns: 1fr 1fr; }
    .plats { grid-template-columns: repeat(2, 1fr); }
    .cards { grid-template-columns: repeat(2, 1fr); }
    .also ul { grid-template-columns: repeat(2, 1fr); }
    .net-paths { grid-template-columns: repeat(3, 1fr); }
    .steps { grid-template-columns: repeat(2, 1fr); }
    .foot-grid { grid-template-columns: repeat(3, 1fr); }
    .tool-grid { grid-template-columns: 1fr 1.1fr; }
}

@media (min-width: 62em) {
    .nav nav { display: flex; }
    .nav .btn-small { margin-left: 0; }
}

@media (min-width: 64em) {
    .plats { grid-template-columns: repeat(4, 1fr); }
    .cards { grid-template-columns: repeat(3, 1fr); }
    .also ul { grid-template-columns: repeat(3, 1fr); }
    .hero-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); }
    .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
    .row.flip .row-text { order: 2; }
    .row.flip .shot { order: 1; }
    .steps { grid-template-columns: repeat(4, 1fr); }
    .news { grid-template-columns: 3fr 2fr; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
