/* The pages as a 1960s/70s electronics operating manual, layered over
   pages.css (/, /instructions, /program). Printed sheets of grey stock,
   askew on the desk: grotesk body, wide-extended headings, a grey second
   ink for what's active, halftone tints, numbered sections, figure
   captions, push-button selectors. */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;700&family=Michroma&display=swap');

:root {
    --desk: #131416;
    --paper: #dfded9;           /* grey uncoated stock */
    --ink: #1a1b1e;
    --ink-soft: rgba(26, 27, 30, 0.68);
    --ink-faint: rgba(26, 27, 30, 0.36);
    --rule: rgba(26, 27, 30, 0.85);
    --pencil: #626366;          /* the spot colour: a grey second ink, as old prints used */
    --halftone: radial-gradient(rgba(70, 71, 75, 0.34) 0.85px, transparent 1.15px) 0 0 / 4px 4px;
}

html, body {
    font-family: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.5;
    background:
        radial-gradient(120% 90% at 50% 0%, #2a2c30 0%, var(--desk) 70%) fixed,
        var(--desk);
}

/* The manual lying on the desk: the top sheet askew, two more under it,
   each turned a little differently and casting its shadow on the next.
   The paper of the top sheet is on its header and main (block
   backgrounds paint above the sheet's negative-z layers, where the
   sheets underneath live). A grain laid over everything with multiply,
   so the ink takes the paper's texture the way print does. */
.sheet {
    background: none;
    box-shadow: none;
    transform: rotate(-0.5deg);
}
main, .page {
    position: relative;
    background-color: var(--paper);
    background-image:
        radial-gradient(120% 40% at 15% 0%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 60%),
        radial-gradient(45% 22% at 72% 38%, rgba(96, 92, 80, 0.07), rgba(96, 92, 80, 0) 70%),
        radial-gradient(35% 18% at 20% 75%, rgba(96, 92, 80, 0.06), rgba(96, 92, 80, 0) 70%),
        radial-gradient(60% 30% at 100% 100%, rgba(70, 72, 78, 0.3), rgba(70, 72, 78, 0) 70%),
        linear-gradient(90deg, rgba(70, 72, 78, 0.15), rgba(70, 72, 78, 0) 3%, rgba(70, 72, 78, 0) 97%, rgba(70, 72, 78, 0.17)),
        linear-gradient(rgba(70, 72, 78, 0) 97%, rgba(70, 72, 78, 0.15)),
        repeating-linear-gradient(90deg, rgba(60, 62, 66, 0.045) 0 1px, transparent 1px 4px);
    border-radius: 0 0 2px 2px;
}
main, .page, .site-nav {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.28);
}
main, .page { box-shadow: inset 0 0 50px rgba(70, 72, 78, 0.16), 0 1px 1px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.28); }
/* Underneath: the bottom sheet, turned the other way, carries the
   shadow on the desk; the middle one is main's, a hair off square. */
.sheet::before,
main::before {
    content: '';
    position: absolute;
    pointer-events: none;
    background-color: #d6d5cf;
    background-image:
        linear-gradient(90deg, rgba(60, 62, 66, 0.14), rgba(60, 62, 66, 0) 4%, rgba(60, 62, 66, 0) 96%, rgba(60, 62, 66, 0.16)),
        repeating-linear-gradient(90deg, rgba(60, 62, 66, 0.045) 0 1px, transparent 1px 4px);
    border-radius: 2px;
}
.sheet::before {
    inset: 0.4rem -0.3rem -0.7rem 0.5rem;
    z-index: -2;
    background-color: #cdccc5;
    transform: rotate(1.5deg);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.45),
        0 18px 40px rgba(0, 0, 0, 0.55),
        0 40px 90px rgba(0, 0, 0, 0.45);
}
main::before {
    inset: -4.6rem 0.2rem -0.35rem -0.45rem;
    z-index: -1;
    transform: rotate(-0.85deg);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
}
@media screen and (max-width: 760px) {
    .sheet::before, main::before { display: none; }
    main, .page, .site-nav { box-shadow: none; }
}
.sheet::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    mix-blend-mode: multiply;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.36 0 0 0 0 0.38 0 0 0 0.34 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.39 0 0 0 0 0.36 0 0 0 0.22 -0.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
}

/* Ink spreads a hair into uncoated paper. */
main, .page, .site-nav { text-shadow: 0 0 0.5px rgba(26, 27, 30, 0.35); }

/* Masthead: a band of the grey ink with a black rule under it, the name
   reversed out of it, the pages as tabs; the current one underlined in
   paper. */
.site-nav {
    background: #4a4b4f;
    color: var(--paper);
    border-bottom: 4px solid var(--ink);
    padding: 1.1rem 2.67rem 1rem;
    column-gap: 1.3rem;
    font-family: 'Michroma', 'Eurostile', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-shadow: none;
}
.site-nav .maker { width: 4.2rem; margin: -0.4rem -0.3rem -0.4rem 0; }
.site-nav .brand { font-size: 1.15rem; letter-spacing: 0.3em; color: var(--paper); }
.site-nav .brand::after {
    content: 'MODEL SL-1 · OPERATING MANUAL';
    display: block;
    margin-top: 0.3rem;
    font-size: 0.55rem;
    letter-spacing: 0.26em;
    opacity: 0.65;
}
.site-nav a { color: rgba(223, 222, 217, 0.75); }
.site-nav a:hover { color: var(--paper); }
.site-nav a[aria-current="page"] { color: var(--paper); }
.site-nav a[aria-current="page"]::before {
    inset: auto 0 -0.55rem 0;
    height: 4px;
    border: 0;
    border-radius: 0;
    background: var(--paper);
    transform: none;
}

h1 {
    font-family: 'Michroma', 'Eurostile', sans-serif;
    font-size: 1.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.25;
}
.lede { color: var(--ink); font-size: 1.07rem; max-width: 58ch; }

/* Numbered sections, a heavy rule over each. */
main { counter-reset: section; }
h2 {
    counter-increment: section;
    border-top: 2px solid var(--ink);
    padding-top: 0.6rem;
    font-family: 'Michroma', 'Eurostile', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.2em;
}
h2::before {
    content: counter(section) '.';
    display: inline-block;
    min-width: 2.2em;
    color: var(--pencil);
}
h2 span { font-family: 'Archivo', sans-serif; font-size: 0.85rem; letter-spacing: 0.02em; }

b, strong { font-weight: 700; letter-spacing: 0.02em; }
a { text-decoration: underline; text-decoration-thickness: 1px; }
a:hover { color: var(--pencil); }

/* Steps: numbers boxed, set in the heading face. */
.steps { list-style: none; counter-reset: step; padding-left: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 2.4rem; }
.steps li::before {
    content: counter(step);
    position: absolute; left: 0; top: 0.1em;
    width: 1.5rem; height: 1.5rem;
    display: grid; place-items: center;
    border: 1.5px solid var(--ink);
    font-family: 'Michroma', sans-serif;
    font-size: 0.7rem;
}

/* Figure caption under the drawing. */
.panel-wrap::after {
    content: attr(data-fig);
    display: block;
    margin: 0.7rem 0 1rem;
    font-family: 'Michroma', sans-serif;
    font-size: 0.6rem;
    letter-spacing: 0.24em;
    text-align: center;
    color: var(--ink-soft);
}

/* The drawing: heavier lines, labels in the heading face. */
.panel .face    { fill: rgba(26, 27, 30, 0.04); stroke-width: 2; }
.panel .knob-face, .panel .nut { stroke-width: 1.6; }
.panel text     { font-family: 'Michroma', 'Eurostile', sans-serif; }
.panel .cap     { font-size: 5.5px; letter-spacing: 0.2px; }
.panel .card-name { font-size: 12px; }
.panel .led.on  { fill-opacity: 0.9; }
.panel .plug    { fill-opacity: 0.5; stroke-width: 2; }
.panel .halo    { transform: none; stroke-dasharray: 3 2; }

/* Buttons: a heavy rectangle; reversed when pressed in. */
.btn {
    border: 2px solid var(--ink);
    font-family: 'Michroma', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    padding: 0.7rem 1.2rem;
}
.btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); border-color: var(--ink); text-shadow: none; }

/* Selectors: a row of push buttons; the one pressed is inked grey. */
.m-label { font-family: 'Michroma', sans-serif; font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink); }
.m-choice { gap: 0; }
.m-choice span {
    padding: 0.35rem 0.8rem;
    border: 1.5px solid var(--ink);
    margin-right: -1.5px;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.22);
}
.m-choice input:checked + span { background: var(--pencil); color: var(--paper); border-color: var(--ink); text-shadow: none; }
.m-choice input:checked + span::before { display: none; }
.m-note { font-size: 0.85rem; }
.m-val { font-family: 'Michroma', sans-serif; font-size: 0.85rem; color: var(--ink); }
.settings input[type="range"]::-webkit-slider-thumb { width: 10px; height: 20px; border-radius: 0; transform: none; border: 1.5px solid var(--ink); }
.settings input[type="range"]::-moz-range-thumb { width: 10px; height: 20px; border-radius: 0; transform: none; border: 1.5px solid var(--ink); }

/* The manual's reference: the hardware name as a tag; the entry being
   pointed at gets a halftone tint of the spot colour. */
.sheet .ref > li { border-top: 1px solid var(--ink-faint); grid-template-columns: 9.5rem 1fr; }
.ref .hw { font-family: 'Michroma', sans-serif; font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); }
.ref .name { font-weight: 700; letter-spacing: 0.1em; }
.sheet .ref > li.hot { background: var(--halftone); }

/* Tooltips: a slip of the same paper, the name set like the panel's. */
.tip { border-width: 1.5px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.28), 0 6px 16px rgba(0, 0, 0, 0.3); text-shadow: 0 0 0.5px rgba(26, 27, 30, 0.35); }
.tip-head b { font-family: 'Michroma', sans-serif; font-size: 0.72rem; letter-spacing: 0.16em; }
.tip-head span { font-family: 'Michroma', sans-serif; font-size: 0.56rem; letter-spacing: 0.14em; text-transform: uppercase; }

/* The programmer's steps. */
.step { border-top: 1px solid var(--ink-faint); }
.step .num { font-family: 'Michroma', sans-serif; color: var(--pencil); }
.step h3 { font-family: 'Michroma', sans-serif; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; }
#code { font-family: 'Michroma', sans-serif; font-size: 1.1rem; }

/* Printing, or saving as a PDF: the content alone, in black on white, each
   sheet of the manual on its own page. The desk, the paper, the tilt and the
   parts that only work on a screen stay behind. */
@media print {
    @page { margin: 12mm; }
    :root { --paper: #fff; --ink: #000; --ink-soft: #333; --ink-faint: #888; --rule: #000; --pencil: #555; }
    html { font-size: 12px; }
    html, body { min-height: 0; background: none; overflow: visible !important; }
    .sheet, .sheet.narrow { max-width: none; margin: 0 !important; background: none; transform: none !important; }
    .sheet + .sheet { break-before: page; }
    .sheet::before, .sheet::after, main::before, main::after, .page::before, .page::after { display: none !important; }
    main, .page { padding: 0; background: none; box-shadow: none; text-shadow: none; }
    .site-nav, .tip, #morse-subs, #unsupported, #btn-connect, #link-status, #fw-status, #btn-program, #bar { display: none !important; }
    .layout { grid-template-columns: 15rem 1fr; gap: 2rem; }
    .panel-wrap { break-inside: avoid; }
    .panel { max-height: none; overflow: hidden; }   /* or the next page's top edge shows at the foot of this one */
    .settings:disabled, .step.locked { opacity: 1 !important; }
    .sheet .ref > li, .steps li, .step, .m-row { break-inside: avoid; }
    .sheet .ref > li.hot { background: none; }
    h2 { break-after: avoid; }
}
