/* Minuet — the score.
   The page is a single piece of music read the way music is read: left to right
   along a staff. Each movement is a bar. Its notehead sits at its own pitch, and
   the shape of the whole page is one rising octave — from 1 in the first bar to
   8 in the coda — because that is what the app is for. Note VALUE carries tempo:
   a whole note for Adagio, a half for Andante, a quarter for Allegro, and the
   bar's WIDTH follows, so fast music is literally closer together.

   Under prefers-reduced-motion the same score is set the other way printers set
   long pieces: one system per line, stacked down the page. Both are real. */

:root{
  --paper:#F3ECDB;--paper-2:#FDFAF1;--stage:#121009;
  --ink:#3A2412;--ink-2:rgba(58,36,18,.82);--ink-3:rgba(58,36,18,.66);
  --acc:#9B7F30;--acc-ink:#6E5518;--acc-soft:rgba(155,127,48,.12);--rule:rgba(58,36,18,.2);--rule-2:rgba(58,36,18,.34);
  --gap:18px;--staff:73px;--top:58%;--lift:44px;--nx:11%;--mast:58px;
  --f-disp:'Playfair Display',Georgia,serif;--f-ui:'DM Sans',system-ui,sans-serif;--f-num:'JetBrains Mono',ui-monospace,monospace;
}
body.stage{
  --ink:#F5F0E8;--ink-2:rgba(245,240,232,.84);--ink-3:rgba(245,240,232,.64);
  --acc:#E0C872;--acc-ink:#E0C872;--acc-soft:rgba(224,200,114,.12);--rule:rgba(224,200,114,.24);--rule-2:rgba(224,200,114,.4);
}
*,*::before,*::after{box-sizing:border-box}
.score-page,.score-page body{height:100%;overflow:hidden}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--room,var(--paper));color:var(--ink);font-family:var(--f-ui);font-size:clamp(1rem,.94rem+.3vw,1.125rem);line-height:1.6;text-wrap:pretty;-webkit-font-smoothing:antialiased}
/* The ink does NOT cross-fade. Transitioning a colour that derives from a
   custom property latches: a descendant starts its transition against an
   ancestor's mid-animation value and never re-fires, leaving text stuck at the
   old ink. The room's ground is interpolated in JS instead, and the ink flips
   at the midpoint of a rest — where the only thing on screen is the fermata. */

/* ---- the sheet ---- */
main{height:100%}
.score{position:relative;height:100%;overflow-x:auto;overflow-y:hidden;display:flex;align-items:stretch;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.score::-webkit-scrollbar{display:none}
.score:focus-visible{outline:2.5px solid var(--acc);outline-offset:-4px}
.bar{position:relative;flex:none;height:100%;--w:780px;--stem:calc(var(--staff) + var(--lift) - (var(--p,1) - 1) * calc(var(--gap) / 2));width:min(var(--w),92vw)}
.bar[data-tempo="allegro"]{--w:620px}
.bar[data-tempo="adagio"]{--w:900px}
.bar.wide{--w:1020px}
.bar.incipit{--w:min(880px,92vw)}
.bar.tail{--w:520px}

/* ---- five lines, and the barline that closes the measure ---- */
.stave{position:absolute;left:0;right:0;top:var(--top);height:var(--staff);background:repeating-linear-gradient(to bottom,var(--rule) 0 1px,transparent 1px var(--gap));background-size:100% 100%}
.stave::before{content:"";position:absolute;inset:0;background:repeating-linear-gradient(to bottom,var(--acc) 0 1px,transparent 1px var(--gap));opacity:0;transform-origin:left}
.bar.sounded .stave::before{opacity:.55}
.stave::after{content:"";position:absolute;right:0;top:0;bottom:-1px;width:1px;background:var(--rule-2)}
.tail .stave,.incipit .stave{display:none}

/* ---- noteheads: the value is the tempo ---- */
.note{position:absolute;left:var(--nx);bottom:calc((var(--p,1) - 1) * (var(--gap) / 2) + 1px);width:17px;height:12px;transform:translateY(50%);color:var(--rule-2)}
.bar.sounded .note{color:var(--acc)}
.note::before{content:"";position:absolute;inset:0;border-radius:50%;transform:rotate(-21deg);background:currentColor}
.note::after{content:"";position:absolute;left:15px;bottom:6px;width:1.9px;height:var(--stem);background:currentColor;opacity:.5}
[data-note="whole"] .note{width:20px;height:13px}
[data-note="whole"] .note::before{background:none;border:2.9px solid currentColor}
[data-note="whole"] .note::after{display:none}
[data-note="half"] .note::before{background:none;border:2.7px solid currentColor}
.note-ring{position:absolute;left:calc(var(--nx) - 13px);bottom:calc((var(--p,1) - 1) * (var(--gap) / 2) - 14px);width:42px;height:42px;border-radius:50%;border:1.5px solid var(--acc);opacity:0;pointer-events:none}
.bar.sounded .note-ring{animation:sound 1100ms cubic-bezier(.2,.7,.2,1) forwards}
@keyframes sound{0%{opacity:.7;transform:scale(.35)}100%{opacity:0;transform:scale(1.15)}}

/* ---- the product, laid on the score like a photograph pinned to a part ---- */
:root{--ph:.84}
.phone{position:absolute;left:56%;top:calc(var(--mast) + 16px);z-index:3;width:calc(390px * var(--ph));height:calc(844px * var(--ph));pointer-events:none}
.phone-in{width:390px;height:844px;transform:scale(var(--ph));transform-origin:top left}
.phone .dev{box-shadow:0 26px 60px rgba(58,36,18,.28),0 0 0 1px rgba(58,36,18,.1)}
body.stage .phone .dev{box-shadow:0 26px 70px rgba(0,0,0,.55),0 0 0 1px rgba(224,200,114,.14)}
.duo{--w:1040px;width:var(--w)}
.duo[data-tempo="allegro"]{--w:940px}
.duo[data-tempo="adagio"]{--w:1150px}
.duo .bar-text{right:auto;width:min(40ch,40%)}
html.js .phone{opacity:0;transform:translateY(22px);transition:opacity 900ms ease 120ms,transform 900ms cubic-bezier(.19,.72,.24,1) 120ms}
html.js .bar.sounded .phone{opacity:1;transform:none}

/* ---- the words sit above the staff, on a stem ---- */
.bar-text{position:absolute;left:var(--nx);right:7%;top:calc(var(--mast) + 20px);bottom:calc(100% - var(--top) + var(--lift));display:flex;flex-direction:column;justify-content:flex-end;max-width:47ch}
.bar-mark{position:absolute;left:var(--nx);top:calc(var(--top) + var(--staff) + 20px);margin:0;font-family:var(--f-num);font-size:.6875rem;letter-spacing:.2em;text-transform:uppercase;color:var(--acc-ink);opacity:.9;white-space:nowrap}

h1{color:var(--ink);font-family:var(--f-disp);font-weight:700;font-size:clamp(2rem,1rem+1.9vw+1.7vh,4.2rem);line-height:1.02;letter-spacing:-.018em;margin:0 0 .42em}
h2{color:var(--ink);font-family:var(--f-disp);font-weight:700;font-size:clamp(1.45rem,.9rem+1vw+1.05vh,2.6rem);line-height:1.1;letter-spacing:-.012em;margin:0 0 .55em;max-width:19ch}
p{margin:0 0 .95em;color:var(--ink-2)}
.bar-text>*:last-child{margin-bottom:0}
.lede{font-size:clamp(1.05rem,.92rem+.3vw+.3vh,1.28rem);line-height:1.5;max-width:42ch}
.incipit .lede{margin-bottom:1.7em}
.incipit-head{font-family:var(--f-disp);font-size:.8125rem;letter-spacing:.42em;text-transform:uppercase;color:var(--acc-ink);margin:0 0 1.4em}
.pull{font-family:var(--f-disp);font-style:italic;font-size:clamp(1.12rem,.9rem+.5vw+.5vh,1.6rem);line-height:1.3;color:var(--acc-ink);max-width:26ch;margin-top:.9em}
.fine{font-family:var(--f-num);font-size:.6875rem;letter-spacing:.09em;text-transform:uppercase;color:var(--ink-3);margin:1em 0 0}
.getrow{margin:.5em 0 0}
.arrow{display:inline-block;padding-left:4px}

/* ---- repeat signs: the brand mark is a piece of score furniture ---- */
.repeat{position:relative;flex:none;width:42px;color:var(--acc-ink)}
.repeat>*{position:absolute;top:var(--top)}
.rp-thick{height:var(--staff);width:6px;background:currentColor;border-radius:1px}
.rp-thin{height:var(--staff);width:2px;background:currentColor;border-radius:1px}
.rp-dots{height:var(--staff);width:8px}
.rp-dots::before,.rp-dots::after{content:"";position:absolute;left:0;width:7px;height:7px;border-radius:50%;background:currentColor}
.rp-dots::before{top:calc(var(--gap) * 1.25 - 3.5px)}
.rp-dots::after{top:calc(var(--gap) * 2.75 - 3.5px)}
.open .rp-thick{left:8px}.open .rp-thin{left:18px}.open .rp-dots{left:26px}
.close .rp-dots{left:8px}.close .rp-thin{left:22px}.close .rp-thick{left:28px}

/* ---- the rests, where the lights change ---- */
.bar.rest{--w:min(560px,74vw)}
.rest .stave{display:block}
.rest .stave::after{display:none}
.whole-rest{position:absolute;left:50%;top:var(--gap);width:26px;height:9px;margin-left:-13px;background:var(--acc);opacity:.85}
.fermata{position:absolute;left:50%;top:-40px;width:56px;height:28px;margin-left:-28px;color:var(--acc);opacity:.85}
.fermata svg{display:block;width:100%;height:100%}
.rest .bar-mark{left:50%;transform:translateX(-50%);opacity:.55}

/* ---- da capo ---- */
.tail .bar-text{justify-content:center;top:var(--mast);bottom:14%}
.da-capo{font-family:var(--f-disp);font-style:italic;font-size:1.5rem;color:var(--acc-ink);margin:0 0 .5em}
.tail-line{max-width:30ch}
.foot-links{display:flex;flex-wrap:wrap;gap:4px 8px;margin:1.4em 0 0 -10px}
.foot-links a{display:inline-flex;align-items:center;min-height:44px;padding:0 10px;font-size:.9375rem;text-decoration:none}
.foot-links a:hover{text-decoration:underline}
.foot-fine{font-family:var(--f-num);font-size:.6875rem;letter-spacing:.09em;text-transform:uppercase;color:var(--ink-3);margin:.6em 0 0}

/* ---- skins as colour, not screenshots ---- */
.skins{list-style:none;margin:1.3em 0 0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 20px}
.skin{display:grid;grid-template-columns:40px minmax(0,1fr);align-items:center;gap:11px;padding:6px 0;border-top:1px solid var(--rule)}
.skin .skinsw{display:block;grid-row:1;align-self:center;height:22px;border-radius:5px;border:1px solid var(--rule);background:linear-gradient(100deg,var(--s1) 0 34%,var(--s2) 34% 68%,var(--s3) 68% 100%)}
.sn{font-weight:600;font-size:.9375rem;color:var(--ink);grid-column:2}
.skintxt{display:none}
.s-walnut{--s1:#2E1B0E;--s2:#8A5A2B;--s3:#C9A84C}
.s-comet{--s1:#080F26;--s2:#2A4A80;--s3:#CFE2F5}
.s-paris{--s1:#26242E;--s2:#E6DFD1;--s3:#C08A94}
.s-arcade{--s1:#120520;--s2:#FF3E8A;--s3:#31E5F0}

/* ---- furniture ---- */
.skip{position:absolute;left:-9999px;top:0;z-index:50;background:var(--paper-2);color:var(--acc-ink);font-weight:600;padding:12px 18px;border-radius:8px}
.skip:focus{left:12px;top:12px}
.mast{position:fixed;top:0;left:0;right:0;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:16px;height:var(--mast);padding-inline:clamp(16px,4vw,44px);isolation:isolate}
.mast::before{content:"";position:absolute;inset:-1px 0 0;z-index:-1;background:linear-gradient(to bottom,var(--room,var(--paper)) 62%,transparent)}
.brand{display:flex;align-items:center;gap:10px;min-height:44px;color:var(--acc-ink);text-decoration:none;font-family:var(--f-disp);font-weight:600;font-size:1.0625rem;letter-spacing:.02em}
.mark{display:block;width:15px;height:15px}
.mark svg{display:block;width:100%;height:100%}
.playhead{position:fixed;left:32%;top:calc(var(--top) - 46px);height:calc(var(--staff) + 92px);width:1px;background:var(--acc);opacity:.3;z-index:5;pointer-events:none}
.hint{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);margin:0;z-index:6;font-family:var(--f-num);font-size:.625rem;letter-spacing:.28em;text-transform:uppercase;color:var(--ink-3);pointer-events:none}
.hint span{display:inline-block;padding-left:6px}
body.moved .hint{opacity:0}
body:not(.rm) .hint{transition:opacity .5s ease}

.btn{display:inline-flex;align-items:center;justify-content:center;min-height:52px;padding:0 25px;border-radius:12px;font-family:var(--f-ui);font-weight:600;font-size:1.0625rem;text-decoration:none;line-height:1.2}
.btn-primary{background:var(--acc-ink);color:var(--paper-2)}
body.stage .btn-primary{color:#17130B}
.btn-quiet{min-height:44px;padding:0 16px;border:1px solid var(--rule-2);color:var(--acc-ink);font-size:.9375rem}
body:not(.rm) .btn{transition:transform .18s ease,box-shadow .18s ease}
.btn-primary:hover{box-shadow:0 6px 20px var(--acc-soft)}
body:not(.rm) .btn-primary:hover{transform:translateY(-1px)}
.btn-quiet:hover{border-color:var(--acc);background:var(--acc-soft)}
a{color:var(--acc-ink)}
a:hover{color:var(--acc)}
:where(a,button,[tabindex]):focus-visible{outline:2.5px solid var(--acc);outline-offset:3px;border-radius:6px}

/* ---- a plain document in the same hand ---- */
.doc .bar{position:static;width:auto;height:auto;max-width:940px;margin:0 auto;padding:calc(var(--mast) + 34px) clamp(16px,5vw,60px) clamp(50px,8vw,90px)}
.doc .bar-text{position:static;display:block;inset:auto;width:auto;max-width:64ch}
.doc h1{font-size:clamp(2.1rem,1.5rem+2.2vw,3.1rem);margin-bottom:.4em}
.doc h2{font-size:clamp(1.2rem,1.05rem+.7vw,1.5rem);max-width:none;margin:2em 0 .5em}
.doc .lede{margin-bottom:2em}
.doc .fine{margin-top:2.6em}
.doc .foot-links{margin-top:2.4em;border-top:1px solid var(--rule);padding-top:1em}

/* ---- a bar sounds as it reaches the playhead ---- */
html.js .bar-text>*{opacity:0;transform:translateY(14px);transition:opacity calc(var(--beat,1) * 600ms) ease,transform calc(var(--beat,1) * 600ms) cubic-bezier(.19,.72,.24,1)}
.bar[data-tempo="adagio"]{--beat:1.45}
.bar[data-tempo="allegro"]{--beat:.6}
html.js .bar.sounded .bar-text>*{opacity:1;transform:none}
html.js .bar.sounded .bar-text>*:nth-child(2){transition-delay:calc(var(--beat,1) * 90ms)}
html.js .bar.sounded .bar-text>*:nth-child(3){transition-delay:calc(var(--beat,1) * 170ms)}
html.js .bar.sounded .bar-text>*:nth-child(4){transition-delay:calc(var(--beat,1) * 250ms)}
html.js .bar.sounded .bar-text>*:nth-child(n+5){transition-delay:calc(var(--beat,1) * 330ms)}
html.js .stave::before{transform:scaleX(0);transition:transform 900ms cubic-bezier(.2,.7,.2,1),opacity .4s ease}
html.js .bar.sounded .stave::before{transform:scaleX(1)}
html.js .bar-mark{opacity:0;transition:opacity 700ms ease .2s}
html.js .bar.sounded .bar-mark{opacity:.9}

@media (max-height:900px){:root{--ph:.76}}
@media (max-height:820px){:root{--top:66%;--lift:34px;--ph:.68}}
@media (max-height:740px){:root{--ph:.6}}
@media (max-height:660px){:root{--top:72%;--lift:26px;--mast:52px;--ph:.52}.incipit-head{margin-bottom:.9em}.skin{padding:4px 0}.skin .skinsw{height:20px}}
@media (max-width:720px){
  :root{--nx:8%;--top:56%;--lift:34px}
  .bar-text{right:6%}
  .phone{display:none}
  .duo{--w:780px;width:min(var(--w),92vw)}
  .duo .bar-text,.duo.wide .bar-text{width:auto;right:6%}
  .skins{grid-template-columns:minmax(0,1fr);gap:4px}
  .playhead{left:22%}
}
@media (prefers-contrast:more){
  :root{--ink-2:var(--ink);--ink-3:var(--ink);--rule:rgba(58,36,18,.5);--rule-2:rgba(58,36,18,.7)}
  body.stage{--ink-2:var(--ink);--ink-3:var(--ink);--rule:rgba(224,200,114,.5);--rule-2:rgba(224,200,114,.75)}
  .btn-quiet{border-width:2px}
}

/* ---- the printed part: one system per line, stacked, already played ---- */
@media (prefers-reduced-motion:reduce){
  .score-page,.score-page body{height:auto;overflow:visible}
  body{background:var(--paper)}
  .score{display:block;height:auto;overflow:visible}
  .playhead,.hint{display:none}
  .repeat{width:auto;height:96px;margin:0 auto;max-width:1000px;padding-inline:clamp(16px,5vw,60px)}
  .repeat>*{top:12px}
  .bar{display:flex;flex-direction:column;width:auto!important;height:auto;max-width:1000px;margin:0 auto;padding:clamp(30px,5vw,54px) clamp(16px,5vw,60px)}
  .bar-text,.bar-mark{position:static;max-width:62ch}
  .bar-text{display:block;left:auto;right:auto;top:auto;bottom:auto}
  .bar-mark{order:-1;font-family:var(--f-disp);font-style:italic;font-size:1rem;letter-spacing:.01em;text-transform:none;color:var(--acc-ink);margin:0 0 1.15em;opacity:1}
  [data-tempo="adagio"] .bar-mark::after{content:" — slowly, at ease"}
  [data-tempo="andante"] .bar-mark::after{content:" — at a walking pace"}
  [data-tempo="allegro"] .bar-mark::after{content:" — briskly"}
  .stave{position:relative;top:auto;margin-top:38px;opacity:.85}
  .stave::before{opacity:.55;transform:none}
  .note{left:5%;--stem:26px}
  .note-ring{display:none}
  .phone{position:static;left:auto;margin:1.8em 0 0;width:calc(390px * .62);height:calc(844px * .62)}
  .phone-in{transform:scale(.62)}
  .duo{--w:auto}
  .duo .bar-text,.duo.wide .bar-text{width:auto}
  .bar.tail .bar-text{top:auto;bottom:auto}
  .rest{padding-block:clamp(26px,4vw,44px)}
  .rest .bar-mark{margin:0 0 34px;transform:none;left:auto;opacity:1}
  .fermata{top:-36px}
  h1{font-size:clamp(2.2rem,1.5rem+2.6vw,3.3rem)}
  h2{font-size:clamp(1.55rem,1.2rem+1.3vw,2.2rem)}
}
