/* instruments.css: the family sorter and the instrument rows. Order: layout, type, colour, motion. */

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

/* Opening: words left, the wide keyboard photograph right, both inside the first window */
.overture--instruments { grid-template-columns: repeat(10, minmax(0, 1fr)); column-gap: var(--sam-rest); padding-inline: var(--sam-rest); }
.overture--instruments > * { grid-column: 1 / -1; }
.overture__words { display: grid; gap: 1.4rem; justify-items: start; min-width: 0; }
.overture__picture { margin: 0; width: 100%; }
.overture__photo { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.overture__sub { display: block; margin-top: 1.1rem; padding-left: 0.9rem; border-left: 0.35rem solid var(--sam-aluminum); }

/* The pinned half is the foundation's; here it sits closer so it fits a short window */
.lesson--families .tally { padding-block: 1.25rem; }
.lesson--families .lesson__score { padding-bottom: calc(var(--sam-bar) * 0.6); }

/* Family sorter: scalloped stamps. On a phone one row that scrolls sideways inside its own box;
   on a desk a full-width row above the split, wrapping if it must */
.sorter { grid-column: 1 / -1; min-width: 0; display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.6rem 0.45rem; scrollbar-width: thin; }
.sorter__stamp {
  position: relative; isolation: isolate; flex: none; min-height: 2.75rem; padding: 0.4rem 1.05rem; border: 0; background: none; cursor: pointer;
  --sam-pitch: 0.95rem;
  --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;
}
.sorter__stamp::before { content: ""; position: absolute; inset: 0; z-index: -1; -webkit-mask: var(--sam-cut-sides); mask: var(--sam-cut-sides); }

/* Families and rows: every entry has the same picture width and the same text position */
.family[hidden] { display: none; }
.family__lead { max-width: 34rem; margin-bottom: 1.6rem; }
.instrument { margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 0.75rem; row-gap: 0.9rem; }
.instrument + .instrument { margin-top: 2.5rem; }
.instrument__photo { grid-column: 1 / -1; grid-row: 1; width: 100%; height: auto; aspect-ratio: var(--sam-shape, 4 / 5); object-fit: cover; }
.instrument__photo--edge { object-position: 0 50%; }
.instrument__words { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
.instrument__text { min-width: 0; }
.instrument__link { display: inline-flex; align-items: center; min-height: 2.75rem; }
.instrument--tall, .instrument--medium { --sam-shape: 4 / 5; }
.instrument--small { --sam-pitch: 1.1rem; }

/* Hand-off: one grid, every piece the same width */
.handover { row-gap: 1.75rem; align-items: start; }
.handover__steps { display: grid; gap: 0.9rem; max-width: 36rem; margin: 0; padding-left: 1.4rem; }
.handover__routes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.handover__cue { min-height: 3.5rem; padding-inline: 1.4rem; justify-content: center; text-align: center; --sam-pitch: 1.3rem; }
.handover__note { grid-column: 1 / -1; margin: 0.25rem 0 0; }
.handover__gifts { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.handover__gift { display: grid; text-decoration: none; }
.handover__gift .tag { display: grid; }
@media (min-width: 30em) {
  .handover__routes, .handover__gifts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 47.5em) {
  .overture--instruments { align-items: center; }
  .overture--instruments .overture__words { grid-column: 1 / 5; grid-row: 1; }
  .overture--instruments .overture__picture {
    grid-column: 5 / 11;
    grid-row: 1;
    position: relative;
    --sam-hero-pitch: 3rem;
    --sam-hero-depth: 0.55rem;
  }
  .overture--instruments .overture__photo {
    --sam-cut: radial-gradient(50% var(--sam-hero-depth) at 50% 100%, #0000 96%, #000) 0 100% / var(--sam-hero-pitch) 100% repeat-x;
  }
  .overture--instruments .overture__picture::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: var(--sam-hero-depth);
    background: var(--sam-denim);
    --sam-hero-top: radial-gradient(50% 100% at 50% 0, #000 96%, #0000) 0 0 / var(--sam-hero-pitch) 100% repeat-x;
    -webkit-mask: var(--sam-hero-top);
    mask: var(--sam-hero-top);
    pointer-events: none;
  }
  /* The pills take their own row above the split; the 8 and the first heading start level below it */
  .lesson--families .sorter { grid-row: 1; flex-wrap: wrap; overflow-x: visible; padding-inline: 0; margin-bottom: 1.5rem; }
  .lesson--families .lesson__pinned, .lesson--families .lesson__score { grid-row: 2; }
  .lesson--families .tally { padding-top: 0; }
  .instrument__photo { grid-column: 1 / 4; }
  .instrument__words { grid-column: 4 / 7; grid-row: 1; align-self: end; }
  .handover__lead { grid-column: 1 / 6; }
  .handover__routes { grid-column: 6 / 11; }
}
@media (min-width: 60em) {
  .lesson--families .sorter { position: sticky; top: var(--sam-capsule-room); z-index: 5; }
  .lesson--families .lesson__pinned { top: calc(var(--sam-capsule-room) + 4.75rem); }
}

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

.overture__sub { font-family: var(--sam-serif-face); font-size: clamp(1.35rem, 1rem + 1.3vw, 2rem); line-height: 1.2; letter-spacing: 0; text-wrap: pretty; }
@media (min-width: 47.5em) { .overture--instruments .overture__title { font-size: clamp(2.5rem, 0.8rem + 4.2vw, 5.25rem); } }
.sorter__stamp { font-size: 0.95rem; line-height: 1.1; white-space: nowrap; }
.instrument__line { margin: 0 0 0.5em; }
.instrument__rate { margin: 0; font-size: var(--sam-size-small); line-height: 1.4; }
.handover__cue { font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem); }
.handover__steps li { font-size: var(--sam-size-body); }

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

.overture__sub { color: var(--sam-chalk); }
.sorter { background: var(--sam-denim); }
.sorter__stamp { color: var(--sam-lacquer); }
.sorter__stamp::before { background: var(--sam-aluminum); }
.sorter__stamp:hover::before { background: var(--sam-chalk); }
.sorter__stamp.now-picked { color: var(--sam-aluminum); }
.sorter__stamp.now-picked::before, .sorter__stamp.now-picked:hover::before { background: var(--sam-lacquer); }
.tally__action, .handover__cue, .handover__gift { color: var(--sam-lacquer); }

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

.sorter__stamp, .sorter__stamp::before { transition: background-color var(--sam-tempo) var(--sam-attack), color var(--sam-tempo) var(--sam-attack); }
@media (prefers-reduced-motion: reduce) { .sorter__stamp, .sorter__stamp::before { transition: none; } }
