/* Sing (sing.html, 11-21, Grey Main for you: "we can put it on the site"): the site's header and footer around Grey's
   singing editor. The editor itself is site/sing/sing.js + sing.css, the same component as Grey Studio's Sing view: not
   copied or changed here. This file only lays out the page, maps the site's colours onto the editor's tokens, and keeps
   the site's own field and slider styles (app.css) out of it. */

/* the page: the site's header (1120 px, as on every page), the editor below it, the one-line footer. The editor's
   Simple view (its default, and all a phone shows) lines up with the header; Edit notes (the piano roll) fills the
   window and is wider (up to 1400 px: its toolbar needs about 1330 px for one row). The footer lines up with it. */
body.singpage { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.singmain { flex: 1 0 auto; display: flex; flex-direction: column; width: 100%; max-width: 1400px; margin: 0 auto;
  padding: 6px 24px 4px; box-sizing: border-box; }
.singpage .sitefoot { max-width: 1400px; box-sizing: border-box; }
.singmain:not(:has(> .sp-host.gs-is-edit)) { max-width: 1120px; }
.singpage:not(:has(.sp-host.gs-is-edit)) .sitefoot { max-width: 1120px; }
.sp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; margin: 0 0 16px; }
.sp-head h1 { margin: 0; font: 600 30px/1.15 var(--display); letter-spacing: -.015em; color: var(--ink); }
.sp-head p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--g-text2); }

/* Edit notes: as tall as the window allows, at least 600 px (the page scrolls below that). Its middle row (piano roll +
   note panel) takes what's left and the note panel scrolls inside it (sing.css sizes those rows). Simple: as tall as
   it is (also before the editor has mounted, so the page doesn't jump) */
.sp-host { flex: none; }
.sp-host.gs-is-edit { flex: 1 1 0; min-height: 0; }
/* (11-21 v3, Randy: "when i scroll down the site itself scrolls") while the melody editor is open the page is exactly
   one window tall and cannot scroll: the wheel and fingers move the piano roll or the note panel, never the site.
   The heading and the footer step aside to give the roll the room. (Windows under 520 px tall keep scrolling.) */
html.gs-editing body.singpage { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
html.gs-editing .singmain { flex: 1 1 0; min-height: 0; padding-bottom: 12px; }
html.gs-editing .sp-head, html.gs-editing .singpage .sitefoot { display: none; }
/* (a short window: the roll gives up height before anything overlaps) */
@media (min-width: 900px) { html.gs-editing .sp-host .gs-ed, html.gs-editing .sp-host .gs-roll { min-height: 150px; } }
@media (max-height: 519px) and (min-width: 900px) {
  html.gs-editing body.singpage { height: auto; overflow: visible; }
  .sp-host.gs-is-edit { flex: none; min-height: 480px; }
}

/* the site's colours as the editor's tokens (site/sing/sing.css reads --bg --panel ... from its host; --ink and --mono
   are the site's own names already). Light and dark follow <html data-scheme> like the rest of the site. */
.sp-host { --bg: var(--paper); --panel: var(--g-soft2); --panel2: var(--paper); --raise: var(--g-soft); --line: var(--g-line);
  --line2: var(--rule-hover); --ink2: var(--ink-2); --muted: var(--mute); --accent: var(--red); --accent2: var(--red-deep);
  --sel: rgba(var(--red-rgb), .1); --sans: var(--body); }
:root[data-scheme="dark"] .sp-host { --panel: var(--g-card); --panel2: var(--g-soft); --raise: var(--wash-2); --sel: rgba(var(--red-rgb), .2); }

/* (app.css styles every field on the site: since its v2 the editor's own field and slider rules win inside it) */

/* the header's light / dark button (the home page has Settings there) */
.g-bar .sp-theme svg { stroke-linejoin: round; }
.g-bar.menu-open .g-right .sp-theme::after { content: "Dark mode"; }
:root[data-scheme="dark"] .g-bar.menu-open .g-right .sp-theme::after { content: "Light mode"; }

/* narrower screens: Edit notes stacks (its own rule below 900 px) and the page simply scrolls */
@media (max-width: 640px) {
  .singmain { padding: 4px 16px 4px; }
  .sp-head h1 { font-size: 26px; }
  .sp-head p { font-size: 14px; }
}
