/* εpsilon sound — "Urtext" edition look.
   Light: engraving ink on staff paper. Dark: nocturne, gold on night blue.
   One family (EB Garamond): small caps for composers, italic for works,
   tabular lining figures for time. */

:root {
  --paper: #F2F1EB;
  --raise: #FAF9F5;
  --ink: #1C2030;
  --ink-2: #4A4F63;
  --ink-3: #7A7E8C;
  --rule: #C9C7BC;
  --accent: #2F4B7C;
  --on-accent: #F7F6F1;
  --select: rgba(47, 75, 124, .09);
  --veil: rgba(28, 32, 48, .28);
  --shadow: 0 18px 50px rgba(28, 32, 48, .16), 0 2px 6px rgba(28, 32, 48, .08);

  --serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --s-0: 13px; --s-1: 15px; --s-2: 18px; --s-3: 24px; --s-4: 36px; --s-5: 54px;
  --bar-h: 72px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0F1526;
  --raise: #151C31;
  --ink: #E7E1D2;
  --ink-2: #B3AD9F;
  --ink-3: #8F897C;
  --rule: #2A3350;
  --accent: #C8A35A;
  --on-accent: #0F1526;
  --select: rgba(200, 163, 90, .11);
  --veil: rgba(4, 7, 15, .55);
  --shadow: 0 18px 60px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--s-2)/1.55 var(--serif);
  font-feature-settings: "onum", "kern", "liga";
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom));
}
body.pal-open { overflow: hidden; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.sc { font-variant: small-caps; font-variant-caps: all-small-caps; letter-spacing: .06em; font-feature-settings: "lnum"; }

kbd.hk {
  font: 500 11px/1 var(--serif);
  font-feature-settings: "lnum";
  padding: 3px 5px 2px; min-width: 18px; text-align: center;
  border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px;
  color: var(--ink-2); background: transparent; display: inline-block;
}
@media (hover: none) { kbd.hk { display: none; } }

/* ---------- top ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
}
.brand { color: var(--ink); text-decoration: none; font-size: var(--s-2); letter-spacing: .02em; }
.brand i { color: var(--accent); font-size: 1.35em; margin-right: 1px; }
.top-tools { display: flex; align-items: center; gap: 6px; }
.tbtn {
  appearance: none; border: 0; background: none; cursor: pointer;
  font-size: var(--s-1); color: var(--ink-2); padding: 6px 8px; border-radius: 4px;
  display: inline-flex; align-items: center; gap: 8px;
}
.tbtn:hover { color: var(--ink); background: var(--select); }
.tbtn-prog { color: var(--ink); }

/* ---------- title page ---------- */
.stage {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 0 clamp(16px, 5vw, 56px);
}
.title-page { text-align: center; max-width: 34em; margin: 0 auto; min-height: 14.5em; display: flex; align-items: flex-end; justify-content: center; }
.tp-composer {
  margin: 0 0 .7em; font-size: var(--s-2); color: var(--ink-2);
  font-variant: small-caps; font-variant-caps: all-small-caps; letter-spacing: .12em;
  font-feature-settings: "lnum";
}
.tp-work {
  margin: 0; font-weight: 500; line-height: 1.12; letter-spacing: -.005em;
  font-size: clamp(34px, 5.6vw, 60px); text-wrap: balance;
  font-feature-settings: "lnum", "kern", "liga", "dlig";
}
.tp-sub { margin: .8em auto 0; font-style: italic; color: var(--ink-2); font-size: var(--s-2); max-width: 30em; text-wrap: balance; }
.tp-actions { margin-top: 1.6em; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cta {
  appearance: none; cursor: pointer; border: 1px solid var(--accent);
  background: var(--accent); color: var(--on-accent);
  font-size: var(--s-2); padding: .42em 1.3em .48em; border-radius: 999px;
}
.cta:hover { filter: brightness(1.08); }
.cta-quiet { background: transparent; color: var(--accent); }

/* the staff: five ruled lines, the spectrum is written onto them */
.staff { margin: 34px auto 0; width: min(1100px, 100%); height: clamp(120px, 20vh, 190px); }
.staff canvas { width: 100%; height: 100%; display: block; }

.credit { text-align: center; margin: 22px auto 0; font-size: var(--s-1); color: var(--ink-3); min-height: 1.6em; max-width: 46em; }
.credit a { color: var(--ink-2); }
.credit .err { color: var(--accent); display: block; margin-top: .3em; }

/* ---------- bottom bar ---------- */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.bar-seek { position: relative; height: 3px; background: transparent; }
.bar-fill { position: absolute; left: 0; top: -1px; height: 3px; background: var(--accent); transition: width .25s linear; }
.bar-seek.live .bar-fill { width: 100% !important; opacity: .35; }
.bar-seek input { position: absolute; inset: -9px 0; width: 100%; opacity: 0; cursor: pointer; margin: 0; }
.bar-seek input:disabled { cursor: default; }
.bar-row {
  height: calc(var(--bar-h) - 3px); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px;
  padding: 0 clamp(12px, 3vw, 32px);
}
.bar-ctrls { display: flex; align-items: center; gap: 4px; }
.ib, .play { appearance: none; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.ib { width: 34px; height: 34px; border-radius: 50%; }
.ib svg { width: 14px; height: 14px; fill: currentColor; }
.ib:hover:not(:disabled) { color: var(--ink); background: var(--select); }
.ib:disabled { opacity: .35; cursor: default; }
.play { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.play svg { width: 16px; height: 16px; fill: currentColor; }
.bar-now { min-width: 0; display: flex; align-items: baseline; gap: 14px; cursor: pointer; }
.bar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--s-2); }
.bar-time { flex: none; color: var(--ink-3); font-size: var(--s-1); font-feature-settings: "tnum", "lnum"; }

/* ---------- ⌘K programme ---------- */
.pal-veil { position: fixed; inset: 0; z-index: 30; background: var(--veil); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.pal {
  width: min(680px, 100%); max-height: min(76vh, 760px); display: flex; flex-direction: column;
  background: var(--raise); color: var(--ink); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow);
  overflow: hidden;
}
.pal-search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.pal-search svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.pal-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: 400 var(--s-3)/1.2 var(--serif);
}
.pal-search input::placeholder { color: var(--ink-3); font-style: italic; }
.pal-tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--rule); overflow-x: auto; overflow-y: hidden; flex: none; }
.pal-tabs button {
  appearance: none; border: 0; background: none; cursor: pointer; padding: 6px 10px 8px; font-size: var(--s-1); color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.pal-tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.pal-body { position: relative; overflow-y: auto; overscroll-behavior: contain; flex: 1; padding: 6px 0 10px; }
.pal-foot { display: flex; gap: 18px; padding: 9px 16px; border-top: 1px solid var(--rule); font-size: var(--s-0); color: var(--ink-3); }
.pal-foot kbd + kbd { margin-left: 3px; }
@media (hover: none) { .pal-foot { display: none; } }
.pal-close { display: none; appearance: none; border: 0; background: none; color: var(--accent); font-size: var(--s-1); padding: 4px 2px; cursor: pointer; }
@media (hover: none), (max-width: 640px) { .pal-close { display: block; } }

.prog { list-style: none; margin: 0; padding: 0; }
.prog li { padding: 0 16px; }
.row-head { padding-top: 14px !important; }
.row-head .head { display: flex; align-items: baseline; gap: 10px; padding: 4px 0 2px; }
.row-head .head .sc { font-size: var(--s-2); color: var(--ink); }
.row-head .head i { color: var(--ink-3); font-size: var(--s-1); }
.prog li[role="option"] { cursor: pointer; }
.prog li.sel { background: var(--select); }
.line { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; min-height: 36px; }
.mark { width: 12px; flex: none; color: var(--accent); }
.lab { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab small { color: var(--ink-3); font-size: var(--s-1); margin-left: .6em; font-style: italic; }
.row-track .lab, .row-station .lab { font-feature-settings: "lnum"; }
.cur .lab { color: var(--accent); }
/* dotted leaders, as in a printed concert programme */
.lead { flex: 1 1 24px; min-width: 24px; border-bottom: 1px dotted var(--ink-3); opacity: .55; transform: translateY(-.28em); }
.dur { flex: none; color: var(--ink-2); font-size: var(--s-1); font-feature-settings: "tnum", "lnum"; }
.row-vol .line { align-items: center; }
.row-vol .lab { flex: none; padding-left: 20px; }
.row-vol input { flex: 1; accent-color: var(--accent); }
.row-empty { padding: 18px 16px !important; color: var(--ink-3); font-style: italic; }

.about { padding: 8px 18px 4px; font-size: var(--s-2); line-height: 1.6; max-width: 36em; }
.about h3 { font-size: var(--s-2); font-weight: 500; margin: 1.3em 0 .4em; }
.about p { margin: .5em 0; }
.credits { margin: .6em 0 0; }
.credits div { padding: .45em 0; border-bottom: 1px dotted var(--rule); }
.credits dt .sc { margin-right: .5em; }
.credits dt i { color: var(--ink-2); }
.credits dd { margin: .1em 0 0; font-size: var(--s-1); color: var(--ink-2); }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 18px; margin: 0; }
.keys div { display: flex; gap: 10px; align-items: baseline; }
.keys dt { flex: none; min-width: 64px; }
.keys dd { margin: 0; color: var(--ink-2); font-size: var(--s-1); }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  :root { --bar-h: 66px; }
  .top { padding: 14px 16px; }
  .top-tools .tbtn-prog { display: none; }
  .title-page { min-height: 12em; }
  .staff { margin-top: 24px; }
  .bar-row { gap: 10px; }
  .bar-ctrls .ib { display: none; }
  .bar-now { flex-direction: column; align-items: stretch; gap: 0; }
  .bar-title { font-size: var(--s-1); }
  .bar-time { font-size: var(--s-0); }
  .pal-veil { padding: 0; align-items: stretch; }
  .pal { max-height: none; height: 100%; border-radius: 0; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
