@layer keyboard, performance, listening;
@import url("keyboard-study/style.css") layer(keyboard);
@import url("keyboard-study/performance.css") layer(performance);
@import url("listening-view.css") layer(listening);
@import url("passage-menu.css");

@font-face {
  font-family: "STIX Two Text";
  src: url("fonts/stix-two-text-regular.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* The three sizes serve the work title, the selected visit, and all reading and controls. */
:root {
  --title-size: 50px;
  --visit-size: 30px;
  --reading-size: 15px;
  font: 400 var(--reading-size)/1.35 "STIX Two Text", Georgia, serif;
  font-synthesis: none;
}
body, main *, dialog, dialog * {
  font-family: inherit;
  font-weight: 400;
  font-style: normal;
  font-size: inherit;
}
h1 { font-size: var(--title-size); line-height: 1.04; letter-spacing: -.035em }
h2 { font-size: var(--visit-size); line-height: 1.08; letter-spacing: -.025em }
.visit-score small { font-size: var(--reading-size); letter-spacing: 0; margin-left: .1em }
header p { line-height: 1.3; min-height: 1lh }
html[data-layout="study"] .listening-edition main { visibility: hidden }
#venue-map:not([href]) { visibility: hidden }
button, select { line-height: 1.2 }

main {
  height: 100vh; height: 100svh;
  display: flex; flex-direction: column;
  padding: clamp(16px, 3.5vh, 38px) clamp(16px, 4vw, 64px) clamp(12px, 2.8vh, 28px);
}
main > :not(.instrument) { flex: none }
.instrument {
  position: relative; flex: 1 0 94px; display: flex; flex-direction: column;
  margin-top: clamp(12px, 2.6vh, 32px);
}
.rail, #journey-labels, .instrument .score-dates { flex: none }
.keybed { flex: 1; height: auto; min-height: 0 }
.reading { min-height: 116px }
.performance:not(.alignment-study) {
  background: #101110;
  --quiet: #b4b0a6;
  --line: #363630;
  --price-mark: #191c1d;
}
.performance:not(.alignment-study) .keybed { background: #191a18; border-bottom: 1px solid #2e2f2a }
.performance:not(.alignment-study) .keybed::after { display: none }
.key, .about-key { --played-face: color-mix(in srgb, var(--trip) 78%, #f1f1ea) }
.performance:not(.alignment-study) .key { --paper: var(--played-face) }
.performance:not(.alignment-study) .key.future { --paper: var(--waiting-face) }
.performance:not(.alignment-study) .inlay { background: var(--price-mark) }
.instrument:not(.full) .key.previewed .face { background: color-mix(in srgb, var(--trip) 46%, #faf9f5) }
.instrument.full .key.previewed { z-index: 1 }
.instrument.full .key.previewed .face { background: #f7f6f1; box-shadow: 0 0 0 1px #f7f6f1 }
@property --hover-stroke {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}
.instrument:not(.full) .key {
  --hover-stroke: 0;
  --travel: max(var(--stroke), var(--hover-stroke));
}
.instrument:not(.full) .key.hover-held { --hover-stroke: 1 }
@media (prefers-reduced-motion: no-preference) {
  .instrument.full .key.previewed .body { transform: scaleY(1.025) }
  .instrument:not(.full) .key {
    transition: --hover-stroke 115ms ease-out;
  }
  .instrument:not(.full) .key.hover-held {
    transition: --hover-stroke 35ms ease-out var(--hover-delay);
  }
}
.instrument.full .inlay { display: none }

#frame {
  border: 0;
  border-inline: 1px solid #a7a9a6;
  background: rgb(225 229 226 / 10%);
}
.instrument.full ~ .overview #frame { display: none }
#status, .visit-score { color: var(--quiet) }
:focus-visible, label input:focus-visible + span {
  outline: 2px solid #c2c6c3;
  outline-offset: 2px;
}
.key:focus-visible { outline: 0 }
.key:focus-visible .face { outline: 2px solid #e9ece9; outline-offset: -2px; box-shadow: inset 0 0 0 3px #444845 }
.instrument.full .key:focus-visible { z-index: 1 }
.instrument.full .key:focus-visible .face { outline-offset: 0 }

.actions { gap: 14px }
#play-slot { display: inline-flex }
.actions #play { min-width: 4.8em }
#play[data-finished] { visibility: hidden }
.actions .text-action:disabled {
  opacity: 1; color: var(--quiet); text-decoration-color: transparent; cursor: default;
}
#entry-play {
  position: absolute; z-index: 1; left: max(25%, calc(50% - 112px)); top: calc(50% - 8px);
  transform: translate(-50%, -50%);
  width: clamp(64px, 7vw, 84px); aspect-ratio: 1; padding: 0;
  display: none; place-items: center;
  opacity: 1;
  color: #e9e5d9; background: transparent;
  border: 1px solid #8d8e80; border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
html[data-opening] #entry-play:not([hidden]) { display: grid }
#entry-play:enabled:hover, #entry-play:focus-visible {
  border-color: currentColor; background: rgb(233 229 217 / 5%);
}
#entry-play:active { background: rgb(233 229 217 / 11%) }
#entry-play > span {
  width: 30%; height: 33%; background: currentColor;
  clip-path: polygon(13% 0, 100% 50%, 13% 100%);
}
#entry-play[aria-busy="true"] { border-style: dashed }
.text-action {
  width: auto; min-width: 46px; height: auto; min-height: 42px;
  padding: 6px 4px; background: none; border: 0; border-radius: 2px;
  color: #d3cfc4; text-decoration: underline; text-decoration-thickness: 1px;
  text-decoration-color: #635f54; text-underline-offset: .28em;
}
.text-action:hover, .text-action:focus-visible {
  color: #f2eee2; text-decoration-color: currentColor;
}
.text-action:focus-visible, #zoom:focus-visible {
  outline: 2px solid #c2c6c3; outline-offset: 2px;
  text-decoration-color: currentColor; text-decoration-thickness: 2px;
  text-underline-offset: .3em;
}
.listening-edition header { gap: 18px }
.listening-edition .actions { gap: 14px }
.score-dates, #time, .visit-score { font-variant-numeric: lining-nums tabular-nums }
#status:not([data-error]) {
  display: block; position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
#status[data-error] { line-height: 1.25; margin-top: 4px }
.visit h2 { overflow-wrap: anywhere; text-wrap: balance }
dialog { border-radius: 3px }
dialog p, dialog a, dialog label { line-height: 1.38 }

@media (max-width: 650px) {
  :root { --title-size: 34px; --visit-size: 24px; --reading-size: 14px }
  main { padding: 14px 16px }
  .listening-edition header { gap: 4px 14px }
  .listening-edition .reading { min-height: 112px }
  .listening-edition header .actions { margin-left: auto }
  .actions, .listening-edition .actions { gap: 10px }
  .scope select { max-width: 132px }
  .overview-title { gap: 6px }
}
@media (max-height: 650px) {
  main { padding-top: 10px; padding-bottom: 10px }
  .instrument { margin-top: 10px }
  .reading { padding-top: 4px; padding-bottom: 6px; min-height: 84px }
  .overview { padding-top: 4px }
  dialog { padding: 16px; max-height: calc(100svh - 18px) }
  dialog p { margin: 8px 0 }
}
@media (max-height: 460px) and (min-width: 540px) {
  :root { --title-size: 30px; --visit-size: 22px; --reading-size: 14px }
  header p { margin-top: 0 }
  .instrument { margin-top: 6px }
  .reading { min-height: 60px; padding: 0 }
  .map { height: 24px }
}

/* Let a visit change without moving the instrument or its transport. */
.visit { width: 100%; container-type: inline-size }
.visit-copy { --title-lines: 1; --metadata-lines: 1 }
.visit .metadata { align-items: start; gap: .8em; margin: 2px 0 0 }
.visit #details { margin: 4px 0 0; min-height: 1lh }
#venue-map {
  color: var(--quiet); white-space: nowrap;
  text-decoration: underline; text-decoration-color: #656662; text-underline-offset: .2em;
}
#venue-map:hover, #venue-map:focus-visible { color: #eeede9; text-decoration-color: currentColor }
.visit-title-slot {
  display: grid; align-items: end;
  font-size: var(--visit-size); line-height: 1.08; min-block-size: calc(var(--title-lines) * 1lh);
}
@container (max-width: 52em) {
  .visit-copy { --title-lines: 2 }
}
@container (max-width: 29em) {
  .visit-copy { --title-lines: 3 }
}
@container (max-width: 22em) {
  .visit-copy { --metadata-lines: 2 }
  .visit .metadata { min-block-size: calc(var(--metadata-lines) * 1lh) }
}
@media (max-width: 650px) {
  .listening-edition .reading { align-items: start }
  /* Keep spare lines below the entire caption so its details follow the name. */
  .listening-edition .visit-copy {
    min-block-size: calc(var(--title-lines) * var(--visit-size) * 1.08 + (1 + var(--metadata-lines)) * 1lh + 6px);
  }
  .listening-edition .visit-title-slot { min-block-size: 1lh; align-items: start }
}
