/* San Jose School of Music: the still half hour. Order: tokens, layout, type, colour, motion. */

/* Tokens: palette, faces, sizes, spacing and timing, all --sam-* */
:root {
  --sam-denim: #587989;
  --sam-lacquer: #080d11;
  --sam-chalk: #ffffff;
  --sam-aluminum: #d0d7db;
  --sam-stencil-face: 'Saira Stencil One', Impact, 'Arial Narrow', sans-serif;
  --sam-serif-face: 'PT Serif', Georgia, 'Times New Roman', serif;
  --sam-size-small: 0.95rem;
  --sam-size-body: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --sam-size-lede: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  --sam-size-question: clamp(1.875rem, 1.2rem + 2.6vw, 3rem);
  --sam-size-title: clamp(2.75rem, 1rem + 5.6vw, 6.5rem);
  --sam-size-figure: clamp(7rem, 4rem + 14vw, 17rem);
  --sam-rest: clamp(1rem, 0.5rem + 2.4vw, 2.5rem);
  --sam-bar: clamp(2.5rem, 9vh, 6.5rem);
  --sam-capsule-room: 5.5rem;
  --sam-ribbon-h: 3.25rem;
  --sam-pitch: 1.6rem;
  --sam-depth: 0.3rem;
  --sam-tempo: 200ms;
  --sam-attack: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ============ LAYOUT ============ */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: var(--sam-capsule-room); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; }
img { display: block; max-width: 100%; height: auto; }
main { display: block; padding-top: var(--sam-capsule-room); }
p { margin: 0 0 1em; }

/* Skip link: .bypass, shown on focus */
.bypass { position: fixed; left: 1rem; top: 1rem; z-index: 60; padding: 0.75rem 1.1rem; transform: translateY(-250%); }
.bypass:focus { transform: none; }

/* Navigation: <sam-capsule class="capsule"> floats top centre; __name, __disc, __menu, __list, __link */
.capsule { position: fixed; top: 0.75rem; left: 50%; z-index: 40; transform: translateX(-50%); display: flex; align-items: center; gap: 0.25rem 1rem; max-width: calc(100vw - 1.5rem); padding: 0.3rem 0.45rem 0.3rem 0.6rem; border-radius: 999px; }
.capsule__name { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; min-width: 0; padding-inline: 0.25rem 0.5rem; }
.capsule__disc { width: 2rem; height: 2rem; flex: none; }
.capsule__list { display: flex; gap: 0.15rem; margin: 0; padding: 0; list-style: none; }
.capsule__link { display: flex; align-items: center; min-height: 2.75rem; padding-inline: 0.85rem; border-radius: 999px; }
.capsule__menu { display: none; min-height: 2.75rem; padding-inline: 1.1rem; border: 0; border-radius: 999px; cursor: pointer; }
@media (max-width: 47.49em) {
  :root { --sam-capsule-room: 5rem; }
  .capsule { width: calc(100vw - 1.5rem); flex-wrap: wrap; justify-content: space-between; border-radius: 1.6rem; }
  .capsule__disc { width: 1.7rem; height: 1.7rem; }
  .capsule__menu { display: flex; align-items: center; flex: none; }
  .capsule__route { flex-basis: 100%; }
  .capsule__list { display: none; flex-direction: column; padding: 0.2rem 0 0.5rem; }
  .capsule.now-open .capsule__list { display: flex; }
}

/* Site grid of ten columns: .stave, children span all ten unless the page places them by line numbers */
.stave { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); column-gap: var(--sam-rest); padding: var(--sam-bar) var(--sam-rest); }
.stave > * { grid-column: 1 / -1; }

/* Split page: <sam-tally class="lesson"> with .lesson__pinned (left, sticky) and .lesson__score (right, scrolls); passages are .lesson__passage */
.lesson { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); column-gap: var(--sam-rest); padding-inline: var(--sam-rest); }
.lesson__pinned, .lesson__score { grid-column: 1 / -1; min-width: 0; }
.lesson__passage { padding-block: var(--sam-bar); }
.lesson__passage + .lesson__passage { padding-top: 0; }
@media (min-width: 47.5em) {
  .lesson__pinned { grid-column: 1 / 6; position: sticky; top: var(--sam-capsule-room); align-self: start; }
  .lesson__score { grid-column: 6 / 11; }
}

/* The recurring device, the still half hour: .tally with __figure (stencil number), __voices > __voice[data-tally-say] (qualifier plates), __action */
.tally { display: grid; justify-items: start; gap: 1.1rem; padding-block: var(--sam-bar); }
.tally__figure { margin: 0; }
.tally__voices { display: grid; max-width: 26rem; }
.tally__voice { grid-area: 1 / 1; padding: 0.75rem 1.5rem; --sam-pitch: 1.1rem; -webkit-mask: var(--sam-cut-sides); mask: var(--sam-cut-sides); }
.tally__voice.now-quiet { visibility: hidden; }

/* Page opening for inner pages: .overture with h1.overture__title and p.overture__answer (the direct answer) */
.overture { display: grid; gap: 1.1rem; justify-items: start; padding-block: var(--sam-bar) calc(var(--sam-bar) * 0.6); }
.overture__title { margin: 0; }
.overture__answer { margin: 0; max-width: 36rem; }

/* Scallop edges for photos and labels: .scallop plus --top, --bottom, --left, --right, --sides, --ends; --broad gives three big ones on a tall strip */
.scallop { -webkit-mask: var(--sam-cut); mask: var(--sam-cut); }
:root, .scallop, .tally__voice, .cue, .tag, .ribbon {
  --sam-cut-sides: radial-gradient(var(--sam-depth) 50% at 0 50%, #0000 96%, #000) 0 0 / 51% var(--sam-pitch) repeat-y, radial-gradient(var(--sam-depth) 50% at 100% 50%, #0000 96%, #000) 100% 0 / 51% var(--sam-pitch) repeat-y;
}
.scallop--top { --sam-cut: radial-gradient(50% var(--sam-depth) at 50% 0, #0000 96%, #000) 0 0 / var(--sam-pitch) 100% repeat-x; }
.scallop--bottom { --sam-cut: radial-gradient(50% var(--sam-depth) at 50% 100%, #0000 96%, #000) 0 0 / var(--sam-pitch) 100% repeat-x; }
.scallop--left { --sam-cut: radial-gradient(var(--sam-depth) 50% at 0 50%, #0000 96%, #000) 0 0 / 100% var(--sam-pitch) repeat-y; }
.scallop--right { --sam-cut: radial-gradient(var(--sam-depth) 50% at 100% 50%, #0000 96%, #000) 0 0 / 100% var(--sam-pitch) repeat-y; }
.scallop--sides { --sam-cut: var(--sam-cut-sides); }
.scallop--ends { --sam-pitch: 3rem; --sam-depth: 0.55rem; --sam-cut: radial-gradient(50% var(--sam-depth) at 50% 0, #0000 96%, #000) 0 0 / var(--sam-pitch) 51% repeat-x, radial-gradient(50% var(--sam-depth) at 50% 100%, #0000 96%, #000) 0 100% / var(--sam-pitch) 51% repeat-x; }
.scallop--broad { --sam-pitch: 33.334%; --sam-depth: clamp(0.8rem, 1.6vw, 1.5rem); }

/* Photograph with caption: figure.still > img.still__photo (add .scallop) + figcaption.still__words */
.still { margin: 0; display: grid; gap: 0.8rem; }
.still__photo { width: 100%; height: 100%; object-fit: cover; }
.still__words { max-width: 40rem; }

/* Rule: hr.barline, a short scalloped silver strip between passages */
.barline { height: 0.55rem; width: min(12rem, 40%); margin: calc(var(--sam-bar) * 0.5) 0; border: 0; --sam-pitch: 0.9rem; --sam-depth: 0.22rem; -webkit-mask: radial-gradient(50% var(--sam-depth) at 50% 100%, #0000 96%, #000) 0 0 / var(--sam-pitch) 100% repeat-x; mask: radial-gradient(50% var(--sam-depth) at 50% 100%, #0000 96%, #000) 0 0 / var(--sam-pitch) 100% repeat-x; }

/* Action plate: a.cue (silver, scalloped ends; the cut is on ::before so focus rings stay whole); .cue--quiet is the outline form */
.cue { position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.9rem; padding: 0.6rem 1.7rem; --sam-pitch: 1.05rem; }
.cue::before { content: ""; position: absolute; inset: 0; z-index: -1; -webkit-mask: var(--sam-cut-sides); mask: var(--sam-cut-sides); }

/* Price label: .tag with __sum (stencil figure) and __label (serif qualifier); scalloped ends */
.tag { display: inline-grid; align-content: start; gap: 0.3rem; padding: 0.95rem 1.6rem 1.05rem; --sam-pitch: 1.1rem; -webkit-mask: var(--sam-cut-sides); mask: var(--sam-cut-sides); }

/* Offer ribbon: #invite.ribbon rolls in from the left along the foot of the first screen */
#invite { position: fixed; left: 0; bottom: 0.75rem; z-index: 35; display: flex; align-items: center; gap: 0.4rem; min-height: var(--sam-ribbon-h); max-width: min(40rem, calc(100vw - 0.75rem)); padding: 0.35rem 1.4rem 0.35rem var(--sam-rest); --sam-pitch: 1.1rem; -webkit-mask: radial-gradient(var(--sam-depth) 50% at 100% 50%, #0000 96%, #000) 0 0 / 100% var(--sam-pitch) repeat-y; mask: radial-gradient(var(--sam-depth) 50% at 100% 50%, #0000 96%, #000) 0 0 / 100% var(--sam-pitch) repeat-y; }
#invite[hidden] { display: none; }
.ribbon__link { padding-block: 0.4rem; }
.ribbon__shut { flex: none; min-width: 2.75rem; min-height: 2.75rem; border: 0; border-radius: 50%; cursor: pointer; }

/* Consent: #storage.oval, a silver oval plate lower right above the ribbon; on a phone a compact one-line oval at the right, above the ribbon */
#storage { position: fixed; right: 1rem; bottom: calc(var(--sam-ribbon-h) + 1.5rem); z-index: 36; display: grid; justify-items: center; gap: 0.15rem; width: min(21rem, calc(100vw - 2rem)); padding: 1.5rem 2.6rem 1.6rem; border-radius: 50%; text-align: center; }
#storage[hidden] { display: none; }
.oval__line { margin: 0; }
.oval__choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; margin-top: 0.55rem; }
.oval__pill { min-height: 2.75rem; padding: 0.3rem 0.95rem; border-radius: 999px; cursor: pointer; }

/* Phone call control: a.dialer, its own ringed silver plate pinned lower left above the ribbon; hidden while the consent oval is showing */
.dialer { position: fixed; left: 0.75rem; bottom: calc(var(--sam-ribbon-h) + 1.25rem); z-index: 34; display: none; align-items: center; justify-content: center; min-width: 2.9rem; min-height: 2.9rem; padding: 0 1rem; border-radius: 999px; }
@media (max-width: 47.49em) { .dialer { display: flex; } }

/* Footer: footer.case, the instrument-case photo with the street above its left edge and directions above its right */
.case { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); column-gap: var(--sam-rest); row-gap: 0.8rem; padding: var(--sam-bar) var(--sam-rest) calc(var(--sam-bar) * 0.8); }
footer.case .case__street { grid-column: 1 / 6; align-self: end; margin: 0; font-family: var(--sam-serif-face); font-size: var(--sam-size-body); font-weight: 400; line-height: 1.45; text-transform: none; font-variant: normal; font-variant-caps: normal; letter-spacing: 0; }
.case__directions { grid-column: 6 / 11; justify-self: end; align-self: end; text-align: right; padding-block: 0.5rem; }
.case__photo { grid-column: 1 / -1; width: 100%; aspect-ratio: 16 / 6; max-height: 62vh; object-fit: cover; }
.case__caption { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1.6rem; margin: 0; }
.case__hours { margin: 0; }
.case__pages { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--sam-rest); row-gap: 1.2rem; }
.case__cluster { min-width: 0; }
.case__label { margin: 0 0 0.35rem; font-family: var(--sam-serif-face); font-size: var(--sam-size-small); font-weight: 400; line-height: 1.3; letter-spacing: 0; text-transform: none; color: var(--sam-chalk); }
.case__list { display: grid; justify-items: start; gap: 0.1rem; margin: 0; padding: 0; list-style: none; }
.case__list a, .case__settings { display: inline-flex; align-items: center; min-height: 2.75rem; }
.case__list a { text-decoration: none; }
.case__list a:hover { text-decoration: underline; }
.case__settings { padding: 0; border: 0; background: none; cursor: pointer; }
@media (max-width: 47.49em) {
  .case { padding-bottom: 11rem; }
  .case__photo { aspect-ratio: 4 / 3; }
  .case__pages { grid-template-columns: minmax(0, 1fr); row-gap: 1.4rem; }
}

/* ============ TYPE ============ */

body { font-family: var(--sam-serif-face); font-size: var(--sam-size-body); line-height: 1.55; text-rendering: optimizeLegibility; }
button { font: inherit; }

/* Headings: h1 and h2 in stencil, flush left, tight, sentence case; h3 in serif */
h1, h2, .tally__figure, .tag__sum { font-family: var(--sam-stencil-face); font-weight: 400; letter-spacing: 0; line-height: 0.92; text-wrap: balance; }
h1 { font-size: var(--sam-size-title); margin: 0 0 0.3em; }
h2 { font-size: var(--sam-size-question); margin: 0 0 0.45em; }
h3 { font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.45rem); font-weight: 400; line-height: 1.25; margin: 0 0 0.4em; }
@media (max-width: 47.49em) { h1 { font-size: clamp(1.75rem, 1rem + 3.5vw, 2.375rem); } }

/* Lede paragraph under a heading: .overture__answer, or add .says-more to any p */
.overture__answer, .says-more { font-size: var(--sam-size-lede); line-height: 1.45; }
.tally__figure { font-size: var(--sam-size-figure); line-height: 0.8; }
.tally__voice { font-size: var(--sam-size-lede); line-height: 1.3; }
.tag__sum { font-size: clamp(2rem, 1.4rem + 2vw, 3rem); }
.tag__label, .still__words, .case__list, .case__hours, .oval__line, .oval__pill, .ribbon__link { font-size: var(--sam-size-small); line-height: 1.4; }
.capsule__name { font-size: 1.02rem; line-height: 1.15; }
.capsule__link, .capsule__menu, .cue, .dialer, .case__caption { font-size: 1rem; }
.ribbon__shut { font-size: 1.4rem; line-height: 1; }
a { text-decoration-thickness: 0.07em; text-underline-offset: 0.2em; }
.capsule a, .cue, .dialer, .ribbon__link { text-decoration: none; }
@media (max-width: 47.49em) { .capsule__name { font-size: 0.95rem; } .oval__line, .oval__pill { font-size: 0.9rem; } }

/* ============ COLOUR ============ */

body { background: var(--sam-denim); color: var(--sam-chalk); }
a { color: inherit; }
h1, h2, .tally__figure { color: var(--sam-lacquer); }
.lesson__pinned { background: var(--sam-denim); }
.capsule, .tally__voice, .cue::before, .tag, #invite, #storage, .dialer, .barline, .bypass { background: var(--sam-aluminum); color: var(--sam-lacquer); }
.dialer { box-shadow: 0 0 0 0.125rem var(--sam-lacquer); }
.tag h2, .tag .tag__sum { color: var(--sam-lacquer); }
.capsule__menu { background: var(--sam-lacquer); color: var(--sam-aluminum); }
.capsule__link:hover, .capsule__link[aria-current="page"] { background: var(--sam-lacquer); color: var(--sam-aluminum); }
.cue:hover::before { background: var(--sam-chalk); }
.cue--quiet::before { background: transparent; box-shadow: inset 0 0 0 0.125rem var(--sam-chalk); }
.cue--quiet { color: var(--sam-chalk); }
.oval__pill { background: transparent; color: var(--sam-lacquer); border: 0.125rem solid var(--sam-lacquer); }
.oval__pill:hover { background: var(--sam-lacquer); color: var(--sam-aluminum); }
.ribbon__shut { background: transparent; color: var(--sam-lacquer); }
.ribbon__shut:hover { background: var(--sam-lacquer); color: var(--sam-aluminum); }
.case__settings { color: inherit; text-decoration: underline; text-decoration-thickness: 0.07em; text-underline-offset: 0.2em; }
.case__school { color: var(--sam-lacquer); background: var(--sam-aluminum); padding: 0.1rem 0.6rem; }

/* Focus ring: white on denim, near-black on silver pieces */
:focus-visible { outline: 0.19rem solid var(--sam-chalk); outline-offset: 0.2rem; }
.capsule :focus-visible, #invite :focus-visible, #storage :focus-visible, .cue:focus-visible, .dialer:focus-visible, .bypass:focus-visible { outline-color: var(--sam-lacquer); }

/* ============ MOTION ============ */

/* Crisp state changes only; photos, the timer and the pinned half never move */
.capsule__link, .capsule__menu, .cue::before, .oval__pill, .ribbon__shut, a { transition: background-color var(--sam-tempo) var(--sam-attack), color var(--sam-tempo) var(--sam-attack), text-decoration-thickness var(--sam-tempo) var(--sam-attack); }
a:hover { text-decoration-thickness: 0.16em; }
.capsule.now-open .capsule__list { animation: sam-unfold 180ms var(--sam-attack); }
@keyframes sam-unfold { from { opacity: 0; transform: translateY(-0.4rem); } to { opacity: 1; transform: none; } }

/* Offer ribbon: off the left edge at rest, rolls in once in 220 ms, leaves when the opening scrolls away */
#invite { transform: translateX(-105%); opacity: 0; transition: transform 220ms var(--sam-attack), opacity 220ms var(--sam-attack), visibility 0s 220ms; visibility: hidden; }
#invite.is-in { transform: none; opacity: 1; visibility: visible; transition: transform 220ms var(--sam-attack), opacity 220ms var(--sam-attack), visibility 0s; }
.now-past #invite.is-in { transform: translateX(-105%); opacity: 0; visibility: hidden; transition: transform 220ms var(--sam-attack), opacity 220ms var(--sam-attack), visibility 0s 220ms; }

/* Reveal on scroll for text blocks: add data-count-in; the script sets .now-seen. Never on photos or the pinned half */
.now-counting [data-count-in]:not(.now-seen) { opacity: 0; transform: translateY(0.6rem); }
[data-count-in] { transition: opacity 240ms var(--sam-attack), transform 240ms var(--sam-attack); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .now-counting [data-count-in]:not(.now-seen) { opacity: 1; transform: none; }
  #invite.is-in { transform: none; }
}

@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
html,body{overflow-x:clip}
@media screen and (min-width: 1921px) {
  html { font-size: calc(100vw / 120); }
}
header :is(a, button), nav :is(a, button) { position: relative; z-index: 2; }

/* ============ PHONE FOOT OF THE PAGE ============ */

/* One short stack, not a quarter of the screen: the ribbon is a single line along the very foot,
   the consent is a compact one-line oval at the right above it (one word, the two pills beside it),
   and the call control waits until the consent is dismissed, then stands at the left on its own plate. */
@media (max-width: 47.49em) {
  #invite { left: 0.5rem; right: 0.5rem; bottom: 0.5rem; max-width: none; min-height: 2.75rem; gap: 0.25rem; padding: 0.25rem 0.4rem 0.25rem 0.7rem; }
  .ribbon__link { flex: 1 1 auto; min-width: 0; padding-block: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem; }
  .ribbon__shut { min-width: 2.75rem; min-height: 2.75rem; }

  #storage { left: auto; right: 0.5rem; bottom: 3.7rem; width: auto; max-width: calc(100vw - 1rem); display: flex; flex-wrap: nowrap; align-items: center; justify-items: start; gap: 0.4rem; padding: 0.25rem 0.3rem 0.25rem 0.9rem; border-radius: 999px; text-align: left; }
  #storage[hidden] { display: none; }
  .oval__line { font-size: 0.9rem; line-height: 1.3; white-space: nowrap; }
  .oval__line--soft { display: none; }
  .oval__choices { display: flex; flex-wrap: nowrap; gap: 0.3rem; margin-top: 0; }
  .oval__pill { min-height: 2.75rem; padding: 0.2rem 0.55rem; font-size: 0.9rem; white-space: nowrap; }

  .dialer { left: 0.5rem; bottom: 3.9rem; z-index: 34; padding: 0 1rem; }
  #storage:not([hidden]) ~ .dialer { display: none; }
}
