/* reader-audio.css — the narration player of the shared reader (reader-audio.js). Loaded only for a piece that
   has audio. Under the header on a wide screen, along the bottom on a phone; it takes a row of the reader's own
   grid, so it never covers the text. */
.shell.has-audio { grid-template-rows: auto auto minmax(0, 1fr); }
.aplayer { display: grid; grid-template-columns: auto minmax(0, 1.1fr) minmax(0, 2fr) auto; gap: 6px 16px; align-items: center; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); font-family: var(--display); min-width: 0; }
.aplayer button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.ap-ctl { display: flex; align-items: center; gap: 2px; }
.ap-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); position: relative; }
.ap-btn:hover { background: var(--sunken); color: var(--fg); }
.ap-btn:focus-visible, .ap-play:focus-visible, .ap-rate:focus-visible, .ap-seek:focus-visible, .ap-cont input:focus-visible, .au-listen:focus-visible, .au-here:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ap-btn svg { width: 20px; height: 20px; }
.ap-btn small { position: absolute; font-size: .44rem; font-weight: 800; top: 50%; left: 0; right: 0; transform: translateY(-38%); text-align: center; letter-spacing: 0; line-height: 1; }
.ap-play { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent) !important; color: var(--accent-ink) !important; margin: 0 4px; flex: none; }
.ap-play svg { width: 20px; height: 20px; }
.ap-now { min-width: 0; display: grid; gap: 1px; }
.ap-now b { font-size: .86rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-now span { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ap-seek { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; margin: 0; }
.ap-seek::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--line) var(--p, 0%)); }
.ap-seek::-moz-range-track { height: 5px; border-radius: 3px; background: var(--line); }
.ap-seek::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--accent); }
.ap-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); margin-top: -4.5px; border: 2px solid var(--surface); }
.ap-seek::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.ap-opt { display: flex; align-items: center; gap: 10px; }
.ap-rate { font-size: .78rem !important; font-weight: 700 !important; min-width: 52px; height: 32px; border-radius: 9px; border: 1px solid var(--line) !important; color: var(--fg) !important; font-variant-numeric: tabular-nums; }
.ap-rate:hover { border-color: var(--accent) !important; }
.ap-cont { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ap-cont input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.ap-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* in the contents list: which sections can be listened to, how long, and which one is playing */
.sec .au-len { margin-left: 6px; font-size: .68rem; color: var(--faint); font-variant-numeric: tabular-nums; flex: none; display: inline-flex; align-items: center; gap: 3px; }
.sec .au-len svg { width: 9px; height: 9px; }
.sec.has-au .min { display: none; }
.sec.au-now .au-len { color: var(--accent); font-weight: 700; }
.sec.au-now .dot { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }

/* the way in: Listen on the map, and "listen to this section" over the text */
.au-listen { display: inline-flex; align-items: center; gap: 12px; margin: 18px 0 4px; padding: 11px 20px 11px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-family: var(--display); font-weight: 700; font-size: .95rem; border: 0; cursor: pointer; }
.au-listen svg { width: 22px; height: 22px; }
.au-listen small { display: block; font-weight: 500; font-size: .74rem; opacity: .85; }
.au-listen span { text-align: left; line-height: 1.2; }
.au-here { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 6px 13px 6px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-family: var(--display); font-weight: 600; font-size: .8rem; cursor: pointer; }
.au-here svg { width: 15px; height: 15px; color: var(--accent); }
.au-here:hover { border-color: var(--accent); }
.au-here[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

@media (max-width: 1100px) { .aplayer { grid-template-columns: auto minmax(0, 1fr) auto; } .ap-line { grid-column: 1 / -1; grid-row: 2; } }
@media (max-width: 860px) {
  /* a phone: the player is the bottom row of the reader */
  .shell.has-audio { grid-template-rows: auto minmax(0, 1fr) auto; }
  .aplayer { order: 3; border-bottom: 0; border-top: 1px solid var(--line); grid-template-columns: minmax(0, 1fr) auto; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); gap: 4px 10px; box-shadow: 0 -8px 24px -18px rgba(0,0,0,.5); }
  .ap-now { grid-column: 1; grid-row: 1; }
  .ap-opt { grid-column: 2; grid-row: 1; }
  .ap-cont span { display: none; }
  .ap-line { grid-column: 1 / -1; grid-row: 2; }
  .ap-ctl { grid-column: 1 / -1; grid-row: 3; justify-content: center; gap: 10px; }
  .ap-btn { width: 44px; height: 44px; } .ap-play { width: 52px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) { .aplayer * { transition: none !important; } }
