/* Gamelan Player (gamelan.html). Each instrument has its own colour in --c (card and grid row). */

.gp-main { max-width: 1240px; }
.gp-crumbs { margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); }
.gp-crumbs a { color: var(--text-muted); }
.gp-main .section-title { margin-top: 6px; }
.gp-main .section-sub { max-width: 760px; }

/* ---- the instruments: picture buttons with a volume bar under each ---- */
.gp-band { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 10px; }
.gp-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gp-inst {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 22px 6px 10px; min-height: 150px; cursor: pointer;
  background: var(--surface-2); color: var(--text-muted);
  border: 2px solid var(--border); border-radius: 12px;
  font: inherit; transition: border-color .15s, box-shadow .15s, background .15s, transform .1s;
}
.gp-inst:hover { border-color: var(--c); }
.gp-inst:active { transform: scale(0.97); }
.gp-inst:focus-visible { outline: 3px solid var(--c); outline-offset: 2px; }
.gp-inst img { width: 100%; height: 70px; object-fit: contain; filter: grayscale(1); opacity: .45; transition: filter .15s, opacity .15s; }
.gp-name { font-weight: 700; font-size: .9rem; line-height: 1.15; text-align: center; }
.gp-note { font-size: .72rem; line-height: 1.1; }
.gp-layer {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 999px; background: var(--bg-elev); color: var(--text-muted);
}
.gp-card.on .gp-inst {
  border-color: var(--c); color: var(--text);
  background: color-mix(in srgb, var(--c) 12%, var(--surface-2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent), var(--shadow);
}
.gp-card.on .gp-inst img { filter: none; opacity: 1; }
.gp-card.on .gp-layer { background: var(--c); color: var(--surface-2); }
.gp-card.on .gp-name { color: var(--c); }

.gp-vol { display: flex; flex-direction: column; gap: 2px; font-size: .68rem; color: var(--text-muted); text-align: center; }
.gp-vol input { width: 100%; accent-color: var(--c); margin: 0; }

/* ---- transport ---- */
.gp-transport {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  margin: 18px 0 14px; padding: 12px 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.gp-play { min-width: 110px; font-size: 1rem; }
.gp-tempo { display: flex; align-items: center; gap: 10px; font-weight: 700; flex: 1 1 260px; }
.gp-tempo input { flex: 1; accent-color: var(--accent-pink); }
.gp-tempo output { min-width: 64px; font-variant-numeric: tabular-nums; }
.gp-beat { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 92px; color: var(--text-dim); }
.gp-transport .btn { padding: 8px 14px; }

/* ---- the grid: one row per instrument, one column per beat ---- */
.gp-grid-wrap { overflow-x: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.gp-grid { min-width: 940px; }
.gp-row { display: grid; grid-template-columns: 170px repeat(16, minmax(0, 1fr)); border-top: 1px solid var(--border-soft); }
.gp-head { border-top: 0; font-weight: 700; font-size: .8rem; color: var(--text-muted); }
.gp-head .gp-cell { display: grid; place-items: center; height: 30px; }
.gp-label {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-end; gap: 1px;
  padding: 6px 12px; text-align: right; background: none; border: 0; font: inherit; color: var(--text-muted);
}
button.gp-label { cursor: pointer; }
.gp-label strong { font-size: .88rem; line-height: 1.15; }
.gp-label span { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }
.gp-cell { position: relative; height: 46px; border-left: 1px solid var(--border-soft); }
.gp-cell.gatra { border-left: 2px solid var(--border-strong); }
.gp-cell.now { background: color-mix(in srgb, var(--accent-amber) 26%, transparent); }

.gp-part { transition: background .15s; }
.gp-part.on { background: color-mix(in srgb, var(--c) 11%, transparent); }
.gp-part.on .gp-label { color: var(--c); }
.gp-part.on .gp-label strong { color: var(--c); }
.gp-part.on .gp-cell.now { background: color-mix(in srgb, var(--accent-amber) 34%, transparent); }

/* a note: placed in its beat by gamelan.js (left = where in the beat it falls) */
.ev {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  font-family: var(--font-display); font-size: 1.15rem; line-height: 1; color: var(--text); opacity: .28;
  transition: transform .08s, opacity .15s;
}
.gp-part.on .ev { opacity: 1; color: var(--c); }
.gp-part.on .ev.hit { transform: translate(-50%, -50%) scale(1.45); }
.ev.hi::before {   /* 1 with a dot = high C */
  content: ""; position: absolute; top: -5px; left: 50%; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: currentColor;
}
.ev.kenong::before {   /* kenong: an arc over the number */
  content: ""; position: absolute; top: -8px; left: -4px; right: -4px; height: 6px;
  border: 2px solid currentColor; border-bottom: 0; border-radius: 8px 8px 0 0;
}
.ev.kempul::after { content: "p"; position: absolute; top: -4px; right: -9px; font-family: var(--font); font-weight: 700; font-size: .62rem; }
.ev.gong { width: 1.75em; height: 1.75em; display: grid; place-items: center; border: 2px solid currentColor; border-radius: 50%; }
.gp-part.u2 .ev { font-size: 1rem; }
.gp-part.u4 .ev { font-size: .88rem; }
.gp-part .ev.drum { font-family: var(--font); font-size: .68rem; font-weight: 600; }
.gp-part .ev.drum.dah { font-weight: 800; }
.gp-part .ev.tick { font-family: var(--font); font-weight: 800; font-size: 1.3rem; }
.gp-part.on .ev.drum.dah { color: var(--accent-pink); }

.gp-key { margin: 12px 4px 0; font-size: .85rem; color: var(--text-dim); }
.gp-key b { font-family: var(--font-display); font-weight: 400; font-size: 1rem; }

@media (max-width: 980px) {
  .gp-band { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .gp-band { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .gp-inst { min-height: 128px; padding-top: 20px; }
  .gp-inst img { height: 54px; }
}
