/* The site: colours, type, the page shell and the controls every page is built from.
   The score reader adds score.css on top of this. */
:root {
    --note: 28px;
    --paper: #f7f4ee;
    --ink: #1c1a17;
    --muted: #5b5650;
    --rule: #d9d3c7;
    /* A border that carries meaning, rather than separating two blocks, has to
       reach 3:1 against the paper behind it; --rule is a hairline and does not. */
    --edge: #8a8378;
    --accent: #1e6a73;
    --accent-ink: #ffffff;
    --focus: #9a5f00;
    --panel: #efeae0;
    --panel2: #e6e0d3;
    --link: #155e66;
    --error: #a11d1d;
    --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", Verdana, system-ui, sans-serif;
    --font-heading: "Newsreader", Georgia, "Times New Roman", serif;
    color-scheme: light;
}

html[data-theme="dark"] {
    --paper: #1b1a18;
    --ink: #ece7dd;
    --muted: #b3aca0;
    --rule: #3a3731;
    --edge: #736e64;
    --accent: #7fd1d8;
    --accent-ink: #0f1a1c;
    --focus: #ffc94d;
    --panel: #24221f;
    --panel2: #2d2a26;
    --link: #8fd6dd;
    --error: #ff9c9c;
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="contrast"]) {
        --paper: #1b1a18;
        --ink: #ece7dd;
        --muted: #b3aca0;
        --rule: #3a3731;
    --edge: #736e64;
        --accent: #7fd1d8;
        --accent-ink: #0f1a1c;
        --focus: #ffc94d;
        --panel: #24221f;
        --panel2: #2d2a26;
        --link: #8fd6dd;
        --error: #ff9c9c;
        color-scheme: dark;
    }
}

html[data-theme="contrast"] {
    --paper: #202020;
    --ink: #ffffff;
    --muted: #ffffff;
    --rule: #ffffff;
    --edge: #ffffff;
    --accent: #ffffff;
    --accent-ink: #202020;
    --focus: #ffff00;
    --panel: #202020;
    --panel2: #202020;
    --link: #75e9fc;
    --error: #ffb3b3;
    color-scheme: dark;
}

html[data-size="large"] { --note: 40px; }
html[data-size="xlarge"] { --note: 56px; }
html[data-size="browser"] { --note: 1.75rem; }
/* Buttons, labels and hints are sized in rem, so raising the root size enlarges
   everything but the note text, which --note sizes on its own. */
html[data-interface="large"] { font-size: 125%; }
html[data-interface="xlarge"] { font-size: 150%; }

* { box-sizing: border-box; }

/* Script hides rows and panels with the hidden property, which a display rule of
   the page's own would otherwise win against. */
[hidden] { display: none !important; }

html { background: var(--paper); }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.25rem;
    line-height: 1.5;
}
html[data-size="browser"] body { font-size: 1.25rem; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.875rem; line-height: 1.15; }
h2 { font-size: 1.75rem; line-height: 1.2; }
h3 { font-size: 1.5rem; line-height: 1.25; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; box-shadow: 0 0 0 6px var(--paper); }

.wrap {
    max-width: 55rem;
    margin: 0 auto;
    padding: 40px 40px 64px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Header and footer */

.skip {
    position: absolute;
    left: -9999px;
    top: 8px;
    background: var(--ink);
    color: var(--paper);
    padding: 8px 12px;
    text-decoration: none;
    font-size: 1.125rem;
    z-index: 1;
}
.skip:focus { left: 16px; }

.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 10px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-size: 1.1875rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--ink);
}
.brand svg { width: 1.75rem; height: 1.75rem; }
.top nav { display: flex; gap: 24px; font-size: 1.0625rem; }

.footer {
    border-top: 1px solid var(--rule);
    padding-top: 16px;
    font-size: 1rem;
    color: var(--muted);
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.meta { font-size: 1.0625rem; color: var(--muted); }
.meta b { color: var(--ink); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 1.0625rem; }

.callout {
    border: 1px solid var(--rule);
    border-left: 6px solid var(--accent);
    background: var(--panel);
    padding: 16px 20px;
    font-size: 1.125rem;
}

/* Controls */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 6px;
    border: 2px solid var(--accent);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}
.btn svg { width: 1.25em; height: 1.25em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
/* A downloaded page opens with playback turned off, so the disabled state is the
   one these buttons are most often read in and it keeps a legible ink. */
.btn:disabled { color: var(--muted); border-color: var(--rule); background: var(--panel); cursor: default; }

.input, select.input {
    min-height: 48px;
    border: 2px solid var(--muted);
    border-radius: 6px;
    background: var(--paper);
    color: var(--ink);
    padding: 0 14px;
    font: inherit;
    font-size: 1.125rem;
}
input.input { width: 6em; }
select.input { padding-right: 10px; }

/* A select is as wide as its longest option, and a flex item will not shrink
   below its content, so a labelled control overflows a narrow window unless it
   is allowed to wrap and the select is capped. */
.goto { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.goto select.input { max-width: 100%; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    align-items: center;
    padding: 12px 0;
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--rule);
    font-size: 1.125rem;
    background: var(--paper);
}
/* On by default and turned off under Settings: a magnified window has little
   height to spare for a bar that never scrolls away. */
/* A phone or a magnified window too short to spare the height leaves it in place. */
@media (min-width: 641px) and (min-height: 600px) {
    html.pin-controls .toolbar { position: sticky; top: 0; z-index: 2; }
    html.pin-controls .group { scroll-margin-top: calc(var(--toolbar-height, 0px) + 8px); }
}
.toolbar .cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pos { font-weight: 700; color: var(--ink); min-width: 9.5em; text-align: center; padding: 0 4px; }
.status { flex-basis: 100%; font-size: 1.0625rem; color: var(--muted); }
.status:empty { display: none; }
.btn.listen { background: var(--accent); color: var(--accent-ink); }
.btn .when-sounding, .btn.sounding .when-idle { display: none; }
.btn.sounding .when-sounding { display: inline; }
/* The message takes a line of its own whether or not there is one to show, so a
   rejected bar number does not move every button after it. */
.error { color: var(--error); font-weight: 700; flex-basis: 100%; }

/* Disclosures */

details { border-top: 1px solid var(--rule); }
details.plain { border: 0; }
summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    font-weight: 700;
}
summary::-webkit-details-marker { display: none; }
summary .chev { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; flex: none; transition: transform 0.15s; }
details[open] > summary .chev { transform: rotate(90deg); }

.disc-row { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.disc-row > details { border: 0; }
.disc-row > details > summary { min-height: 48px; font-size: 1.125rem; font-weight: 400; }
.disc-row > details[open] { flex-basis: 100%; }

.panel {
    background: var(--panel);
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 8px;
}
.panel .row { display: flex; gap: 16px 28px; align-items: center; flex-wrap: wrap; }
.panel h2 { font-family: var(--font-body); font-size: 1.25rem; font-weight: 700; }
.goto-row .error:empty { display: none; }

/* Settings on the reading page: one tab list over four panels. */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--edge); margin: -8px 0 0; }
.tab {
    min-height: 48px;
    padding: 0 14px;
    border: 0;
    border-bottom: 4px solid transparent;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 1.125rem;
    cursor: pointer;
}
.tab[aria-selected="true"] { font-weight: 700; border-bottom-color: var(--accent); }
.tab-panel { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.goto.stacked { flex-direction: column; align-items: flex-start; font-weight: 700; }
.goto.stacked select { font-weight: 400; }
.natural { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; border: 1px solid var(--edge); border-radius: 6px; background: var(--paper); }
.natural p { flex: 1 1 18rem; }
.style-choice { align-items: flex-start; flex-wrap: nowrap; padding: 4px 0; }
.style-choice input { margin-top: 2px; }
.style-choice .name { font-weight: 700; }
.style-choice .hint { display: block; }
#rewrite-error:empty { display: none; }
.keys { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 20px; margin: 0; }
.keys dt { font-weight: 700; }
.keys dd { margin: 0; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > legend, .field > .legend { font-weight: 700; padding: 0; }
.legend.prompt { font-weight: 400; margin-bottom: 12px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

.sizes { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.size {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 6px 16px;
    border: 2px solid var(--muted);
    border-radius: 8px;
    padding: 14px 18px;
    align-items: start;
    cursor: pointer;
    background: var(--paper);
}
.size:has(input:checked), .size.checked { border-color: var(--accent); background: var(--panel2); }
.size input { width: 28px; height: 28px; margin: 4px 0 0; accent-color: var(--accent); }
.size .name { font-weight: 700; font-size: 1.25rem; }
/* The sample is set at the size it is describing, so at extra large a single
   word is wider than the panel and has to be allowed to break. */
.size .demo { grid-column: 2; line-height: 1.35; overflow-wrap: anywhere; }

.check { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; cursor: pointer; }
.check input { width: 26px; height: 26px; margin: 0; accent-color: var(--accent); }

.contents li { border-bottom: 1px solid var(--edge); display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.contents li a { display: inline-flex; align-items: center; min-height: 44px; }
.contents li:last-child { border-bottom: 0; }
.contents .prev { color: var(--muted); font-size: 1.0625rem; }
.contents .result { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }

/* Read by a screen reader but not seen; a name for a control whose visible label alone would not say what it acts on. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.facts { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 6px 24px; margin: 0; }
.facts dt { font-weight: 700; }
.facts dt, .facts dd { overflow-wrap: anywhere; }
.facts dd { margin: 0; }
.about { display: flex; flex-direction: column; gap: 16px; }
.about h2 { font-family: var(--font-body); font-size: 1.125rem; font-weight: 700; margin-top: 8px; }
.links { display: flex; flex-wrap: wrap; gap: 12px; }

.live { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Phone */
@media (max-width: 640px) {
    .wrap { padding: 20px 16px 48px; gap: 20px; }
    .toolbar .cluster { flex: 1 1 100%; }
    .toolbar .pos { order: -1; flex-basis: 100%; text-align: left; padding: 0; }
    .toolbar .btn { flex: 1 1 auto; }
    .disc-row { flex-direction: column; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    summary .chev { transition: none; }
}

@media (forced-colors: active) {
    .btn, .input, .size, .panel, .callout { border-color: CanvasText; }
}

/* Print: the page on paper, no controls */
@media print {
    /* Overrides the dark and contrast palettes whichever way they were chosen: the toggle, the export attribute or the system setting. */
    html, html[data-theme] {
        --paper: #ffffff !important;
        --ink: #000000 !important;
        --muted: #333333 !important;
        --rule: #999999 !important;
        --panel: #eeeeee !important;
        --panel2: #eeeeee !important;
        --accent: #000000 !important;
        --link: #000000 !important;
        --note: 20pt;
        color-scheme: light !important;
    }
    html, body { background: #ffffff; color: #000000; }
    body { font-size: 14pt; line-height: 1.45; }
    .wrap { max-width: none; padding: 0; gap: 20px; }
    .skip, .top nav, .toolbar, .disc-row, .noscript, .live, .footer > a { display: none !important; }
    h1 { font-size: 28pt; }
    .meta { font-size: 14pt; }
    a { color: #000; text-decoration: none; }
}

/* The pages either side of the reading page: opening a score, setting it up,
   waiting for it and being told when it could not be read. */

body:not(.reader) main { display: flex; flex-direction: column; gap: 32px; }

.lead { font-size: 1.375rem; margin-top: 12px; }

.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary { min-height: 60px; padding: 0 28px; font-size: 1.375rem; }

.form { display: flex; flex-direction: column; gap: 24px; }
.form > .btn { align-self: flex-start; }

/* Shown on the file field while a dragged file is over it; the outline is a shape
   change, not only a colour change, so it still reads under a colour filter. */
.field.drag-over { outline: 3px dashed var(--accent); outline-offset: 6px; border-radius: 6px; }
.actions { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

/* The whole link stays visible where there is room, and wraps under its button on a phone. */
.share .input { flex: 1 1 18rem; min-width: 0; }
.goto.wide input[type="range"] { width: 16rem; max-width: 100%; min-height: 44px; accent-color: var(--accent); }

.error-callout { border-left-color: var(--error); }
.callout p { margin: 0 0 8px; }
.callout p:last-child { margin-bottom: 0; }
/* One error to a line, each linking to the control it is about. */
.errors { margin: 0; padding-left: 20px; }
.errors li + li { margin-top: 8px; }

input[type="file"] { font: inherit; font-size: 1.125rem; }
input[type="file"]::file-selector-button {
    min-height: 48px;
    padding: 0 16px;
    margin-right: 12px;
    border-radius: 6px;
    border: 2px solid var(--accent);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
}
input[type="url"].input { width: 100%; max-width: 520px; }

/* Reading styles, each shown with the same bar written its way. */
.cards { display: flex; flex-direction: column; gap: 12px; }
.card {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 6px 16px;
    border: 2px solid var(--edge);
    border-radius: 8px;
    padding: 16px 20px;
    background: var(--paper);
}
.card:has(input:checked) { border-color: var(--accent); background: var(--panel); }
.card input { width: 28px; height: 28px; margin: 4px 0 0; accent-color: var(--accent); }
/* The sample sits outside the label, so the name and the line describing the
   style are the whole click target and the whole spoken name of the choice. */
.card label { cursor: pointer; }
.card .name { font-weight: 700; font-size: 1.375rem; }
.card .who { color: var(--muted); font-size: 1.0625rem; display: block; }
.card .sample {
    grid-column: 2;
    font-family: var(--font-heading);
    font-size: 1.3125rem;
    padding: 8px 12px;
    border-left: 1px solid var(--edge);
}
.card .sample.mono { font-family: "Atkinson Hyperlegible Mono", ui-monospace, Menlo, monospace; font-size: 1.125rem; }

/* Grouped settings behind the disclosure on the options page. */
.box-set {
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.box-set > legend { font-weight: 700; padding: 0 8px; }
/* Same cap as .goto: the settings rows hold the longest option strings on the
   site and are the first thing to overflow at 400% magnification. */
.setting { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.setting select.input { max-width: 100%; }

/* The options page: three sections, the last a set of closed disclosures that
   each name their current choices on the closed line. */
.form.options { gap: 48px; }
.option-section { display: flex; flex-direction: column; gap: 14px; }
.section-title { font-family: var(--font-heading); font-size: 1.75rem; font-weight: 500; padding: 0; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 1.0625rem; }
.card.own { border-style: dashed; }
.sections { display: flex; flex-direction: column; border-bottom: 1px solid var(--rule); }
.section > summary { min-height: 56px; font-weight: 400; font-size: 1.1875rem; flex-wrap: wrap; column-gap: 12px; row-gap: 0; padding: 4px 0; }
.section > summary .label { font-weight: 700; }
.section > summary .current { margin-left: auto; color: var(--muted); font-size: 1.0625rem; }
.section-body { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 4px 0 24px 2rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 4px 24px; width: 100%; }
.checks .check { min-height: 44px; }
.colour-detail { display: flex; flex-direction: column; gap: 16px; }


.noscript { border: 1px solid var(--rule); padding: 12px 16px; font-size: 1.125rem; background: var(--panel); }

@media (max-width: 640px) {
    body:not(.reader) main { gap: 20px; }
    .lead { font-size: 1.25rem; }
    .card { grid-template-columns: 28px minmax(0, 1fr); padding: 14px 16px; }
    .section-body { padding-left: 0; }
    .section > summary .current { margin-left: calc(1em + 12px); flex-basis: 100%; }
}

.bullets { list-style: disc; padding-left: 24px; display: flex; flex-direction: column; gap: 6px; }

/* The change log is a long list of dated entries, so the date carries the
   grouping and a rule separates one entry from the next. */
.changelog { display: flex; flex-direction: column; gap: 24px; }
.entry { display: flex; flex-direction: column; gap: 8px; padding-bottom: 24px; border-bottom: 1px solid var(--rule); }
.entry:last-child { border-bottom: 0; padding-bottom: 0; }
.entry h2 { font-size: 1.25rem; color: var(--muted); font-family: var(--font-body); font-weight: 700; }

input[type="color"] { width: 56px; height: 40px; padding: 2px; border: 2px solid var(--muted); border-radius: 6px; background: var(--paper); }
