/* The emulator's page: the FM-1's (index.html) and the SMK-37's (smk37/index.html) */
:root { --room: #18191b; --ink: #e9e6de; --dim: #a9a7a1; --faint: #8c8a85; --text: #c9c6be; --amber: #f2a33a;
        --amber-hi: #ffc56e; --green: #7cc48a; --well: #232427; --line: #3a3b3f; --rule: #2a2b2e; --card: #1e1f22;
        --bar: #161719; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--room); color: var(--ink);
             font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
html { scroll-padding-top: 12px; }
a { color: var(--amber); }
a:hover { color: var(--amber-hi); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.dim { color: var(--dim); }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); }
kbd { display: inline-block; min-width: 1.7em; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px;
      border-radius: 4px; background: var(--well); color: var(--ink); font: 600 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      text-align: center; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }

/* ---------------------------------------------------------------- the site's header and footer */
.wrap { max-width: 1360px; margin: 0 auto; padding-inline: 24px; }
header.site { border-bottom: 1px solid var(--rule); background: var(--bar); }
header.site .wrap { padding-block: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 16px; }
.brand:hover { color: var(--ink); }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--amber); color: #2a1a03; display: grid; place-items: center; }
/* the device switch: one segment per device */
.devices { display: flex; background: var(--well); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.devices a, .devices span { padding: 4px 12px; border-radius: 6px; font-size: 13px; text-decoration: none; color: var(--dim); }
.devices a:hover { color: var(--ink); }
.devices [aria-current] { background: var(--line); color: var(--ink); font-weight: 500; }
.sitenav { display: flex; flex-wrap: wrap; gap: 2px; font-size: 14px; }
.sitenav a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.sitenav a:hover { color: var(--ink); background: var(--rule); }
/* the way to the code: always in view, on a phone too */
.gh { margin-left: auto; display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 11px;
      border: 1px solid #55565b; border-radius: 999px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; }
.gh:hover { color: var(--ink); border-color: var(--dim); background: var(--rule); }
.gh .arrow { color: var(--dim); }
@media (max-width: 760px) {
  .wrap { padding-inline: 16px; }
  header.site .wrap { gap: 8px 12px; }
  /* the site's links get a row of their own below the brand */
  .sitenav { order: 5; flex-basis: 100%; margin: -4px -10px 0; }
  .gh { padding: 0 11px; }
  .gh span { display: none; }
}

footer.site { margin-top: 48px; border-top: 1px solid var(--rule); background: var(--bar); color: var(--dim); font-size: 13px; }
footer.site .wrap { padding-block: 28px 36px; display: flex; flex-wrap: wrap; gap: 24px 56px; }
footer.site b { color: var(--ink); font-weight: 600; }
footer.site .about-site { flex: 1 1 340px; display: flex; flex-direction: column; gap: 8px; max-width: 70ch; }
footer.site .col { display: flex; flex-direction: column; gap: 6px; }
footer.site .col a { text-decoration: none; }

/* ---------------------------------------------------------------- the player: the synth, and beside it what runs */
main { max-width: 1360px; margin: 0 auto; padding: 20px 24px 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; }
@media (max-width: 760px) { main { padding: 14px 16px 0; gap: 36px; } }
.player { display: flex; flex-wrap: wrap; gap: 20px 24px; align-items: flex-start; }
.deck { flex: 999 1 600px; min-width: 0; display: grid; gap: 12px; }
.deck-head { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; justify-content: space-between; }
h1 { font-size: 17px; font-weight: 600; margin: 0; }
#status { color: var(--dim); font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.stage { position: relative; padding: 16px; border: 1px solid var(--rule); border-radius: 18px;
         background: radial-gradient(120% 90% at 30% 0%, #26272b 0%, #1b1c1f 70%); }
/* the whole synth in view on a laptop: as wide as the room allows below the header (--above,
   --aspect: set by main.js; 84px: the stage's padding and the hint line), never narrower than 560px */
canvas { display: block; width: 100%; height: auto; touch-action: none; user-select: none; margin: 0 auto;
         max-width: max(560px, calc((100svh - var(--above, 140px) - 84px) * var(--aspect, 1.56))); }
#start { position: absolute; inset: 0; margin: auto; width: clamp(110px, 30%, 220px); height: clamp(36px, 9vw, 56px);
         border: 0; border-radius: 28px; background: var(--amber); color: #2a1a03; font-size: clamp(14px, 3.5vw, 17px);
         font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
#start:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
#start[disabled] { opacity: .7; cursor: wait; }
.rotate { display: none; color: var(--dim); font-size: 13px; margin: 0; }
/* a phone upright: the panel is small; say that sideways gives bigger keys */
@media (orientation: portrait) and (max-width: 600px) {
  .rotate { display: block; }
  .stage { padding: 6px; border-radius: 12px; }
}
/* a phone on its side: the panel fits the screen's height, the page around it shrinks */
@media (orientation: landscape) and (max-height: 560px) {
  main { padding-block: 8px 0; }
  .stage { padding: 0; border: 0; background: none; }
  canvas { width: auto; max-width: 100%; height: calc(100svh - 12px); margin: 0 auto; }
}

/* under the synth: one line of the essentials, then the way into the guide */
.hint { margin: 0; color: var(--dim); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.hint span { white-space: nowrap; background: var(--card); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 10px; }
.hint .more { margin-left: auto; }
.touch { display: none; }
@media (hover: none) and (pointer: coarse) { .hint .keyb { display: none; } .hint .touch { display: inline; } }

/* the device can't keep up: what happens and the fix, above the synth */
#perfwarn { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between;
            border: 1px solid var(--amber); border-radius: 10px; background: #2a2116; padding: 9px 12px; }
#perfwarn[hidden] { display: none; }
#perfwarn p { margin: 0; flex: 1 1 320px; min-width: 0; }
#perfwarn .acts { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 14px; }
#perfwarn button.primary { background: var(--amber); border-color: var(--amber); color: #2a1a03; font-weight: 600; }
#perfwarn button[hidden] { display: none; }

/* beside the synth (below it on a narrow screen): the firmware, the save, MIDI */
.side { flex: 1 1 300px; max-width: 100%; display: grid; gap: 14px;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.box { background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 16px;
       display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.box > label { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--dim); font-size: 14px; }
.box > label select { min-width: 0; max-width: 62%; }
.box .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sel { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 62%; }
.sel select { max-width: 100%; }
#about { margin: 0; color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
#about b { display: block; color: var(--ink); font-size: 17px; font-weight: 600; }
#about .links { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 2px 0 6px; }
#about .what { display: block; }
select { font: inherit; font-size: 14px; color: var(--ink); background: var(--well); border: 1px solid var(--line); border-radius: 7px;
         padding: 5px 8px; max-width: 100%; }
select:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
/* the page's buttons, and file pickers that look like them */
.box button, #perfwarn button, .file { font: inherit; font-size: 14px; color: var(--ink); background: var(--well);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.box button:hover, #perfwarn button:hover, .file:hover { border-color: var(--faint); }
.file { position: relative; }
.file:focus-within { outline: 2px solid var(--amber); outline-offset: 1px; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
#midiact { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
#midiact.on { background: var(--amber); }
#save-status { color: var(--text); font-size: 14px; }
#save-status[data-error="true"] { color: var(--amber); }
.save-controls { margin: 0; padding: 0 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--room); }
.save-controls summary { padding: 8px 0; font-size: 13px; font-weight: 500; color: var(--dim); cursor: pointer; }
.save-controls[open] { padding-bottom: 10px; }
.save-controls .save-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.save-controls p { color: var(--dim); font-size: 12.5px; margin: 10px 0 0; }

/* ---------------------------------------------------------------- the firmware library (built by main.js from firmwares.json) */
.library h2, .article section h2 { margin: 0 0 8px; font-size: 24px; font-weight: 600; letter-spacing: -.005em; }
.library > p { margin: 0; color: var(--dim); max-width: 86ch; }
.cards { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 14px;
         grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.cards li { margin: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 14px;
            padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.cards li.on { border-color: #6b5226; box-shadow: inset 0 0 0 1px #6b5226; }
.cards .head { display: flex; gap: 8px; align-items: baseline; }
.cards .head b { font-size: 16px; }
.cards .head .dim { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.cards .head button { margin-left: auto; font: inherit; font-size: 13px; font-weight: 600; color: var(--amber); background: none;
                      border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; cursor: pointer; }
.cards .head button:hover { border-color: var(--amber); }
.cards li.on .head button { background: var(--amber); border-color: var(--amber); color: #2a1a03; }
.cards .by { color: var(--dim); font-size: 13px; }
.cards .what { margin: 4px 0; font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }
.cards .midi { font-size: 12.5px; color: var(--amber); }
.cards .links { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 13px;
                display: flex; flex-wrap: wrap; gap: 2px 14px; }
.cards .links a { color: var(--dim); text-decoration: none; }
.cards .links a:hover { color: var(--amber-hi); }

/* ---------------------------------------------------------------- the guide: its contents beside it on a wide screen */
.guide { border-top: 1px solid var(--rule); padding-top: 36px; display: grid; gap: 28px 56px; grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .guide { grid-template-columns: 200px minmax(0, 1fr); align-items: start; }
  nav.toc { position: sticky; top: 20px; flex-direction: column; flex-wrap: nowrap; gap: 0; }
  nav.toc a { border: 0; border-left: 2px solid var(--rule); border-radius: 0; padding: 5px 0 5px 12px; }
  nav.toc a:hover { border-left-color: var(--amber); }
}
nav.toc { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: flex-start; font-size: 14px; }
nav.toc .eyebrow { width: 100%; margin-bottom: 8px; }
nav.toc a { color: var(--dim); text-decoration: none; border: 1px solid var(--rule); border-radius: 14px; padding: 2px 10px; }
nav.toc a:hover { color: var(--ink); }
.article { max-width: 780px; min-width: 0; display: grid; gap: 40px; }
.article section h2 { font-size: 22px; }
section h3 { margin: 18px 0 6px; font-size: 15px; font-weight: 600; }
section p, section li { color: var(--text); }
section p { margin: 0 0 10px; }
section b, section strong { color: var(--ink); font-weight: 600; }
section ul, section ol { margin: 0 0 10px; padding-left: 22px; }
section li { margin: 4px 0; }
.lead { font-size: 17px; line-height: 1.55; color: var(--ink) !important; }
.steps { list-style: none; padding: 0 !important; margin: 16px 0 0 !important; display: grid; gap: 12px;
         grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); counter-reset: step; }
.steps li { margin: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px 12px 50px;
            position: relative; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 14px; top: 12px; width: 24px; height: 24px; border-radius: 50%;
                    background: var(--amber); color: #2a1a03; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.steps b { display: block; margin-bottom: 2px; }

/* the computer keyboard as a piano: 11 white keys, the black ones between */
.piano { display: grid; grid-template-columns: repeat(22, 1fr); gap: 3px; max-width: 460px; margin: 4px 0 12px; }
.piano span { display: grid; place-items: center; border-radius: 0 0 5px 5px; padding: 4px 0 3px; line-height: 1.15;
              font: 600 13px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: center; }
.piano i { display: block; font: 10.5px/1.2 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--dim); }
.piano .w { grid-row: 2; grid-column-end: span 2; background: #2c2d31; border: 1px solid #44454a; color: var(--ink); }
.piano .b { grid-row: 1; grid-column-end: span 2; margin: 0 3px; background: #0f1011; border: 1px solid #36373b; color: var(--ink); }
.map { list-style: none; padding: 0 !important; display: grid; gap: 6px 10px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.map li { margin: 0; white-space: nowrap; color: var(--ink); font-size: 13px; }
.map kbd { margin-right: 4px; }

.note { border-left: 3px solid var(--amber); background: var(--card); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.article details { border: 1px solid var(--rule); border-radius: 10px; background: var(--card); padding: 0 14px; margin: 0 0 10px; }
.article details[open] { padding-bottom: 4px; }
.article summary { cursor: pointer; padding: 10px 0; font-weight: 600; color: var(--ink); }

/* ?embed=1 (main.js): the device and its controls only, for a window on another site */
.embed-only { display: none; }
[data-embed] .embed-only { display: inline; margin-left: auto; font-size: 13px; }
[data-embed] header.site .wrap > :not(.embed-only), [data-embed] #title, [data-embed] #fwlabel, [data-embed] .file,
[data-embed] #bankname, [data-embed] #about, [data-embed] .hint, [data-embed] .library, [data-embed] .guide,
[data-embed] footer.site, [data-embed] .save-box, [data-embed] .side .eyebrow { display: none; }
[data-embed] main { padding: 8px; gap: 8px; }
[data-embed] .side { flex-basis: 100%; }
[data-embed] .box { padding: 10px 12px; flex-direction: row; flex-wrap: wrap; gap: 8px 20px; }
[data-embed] .box > label select { max-width: none; }

/* (an element the page hides stays hidden whatever its display rule) */
[hidden] { display: none !important; }
