/* =====================================================================
   cm-audio.css: Listen cards and audio players for cmtext chapter pages.
   Load only on pages with audio examples, paired with cm-audio.js:
     head:   <link rel="stylesheet" href="../_chapter_includes/css/cm-audio.css">
     bottom: <script src="../js/cm-audio.js?v=YYYYMMDD"></script>  (after scripts.php)
   Markup: div.cm-listen > div.cm-listen-flag + div.cm-listen-body >
           p.cm-listen-head + div.cm-listen-grid (add cm-listen-one for a single example) >
           div.cm-listen-tile > p.cm-listen-label + <audio controls preload="none">
   First used on chapter2_effects.php, October 2026.
   ===================================================================== */

/* ---------- Listen cards ---------- */
.cm-listen {
  display: flex;
  max-width: 950px;
  margin: 1.5rem auto 2rem;
  background-color: #f5f5f5;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  text-align: left;
}
.cm-listen-flag {
  flex: 0 0 4.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #23879a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cm-listen-flag .svg-inline--fa { font-size: 1.35rem; margin-bottom: 0.35rem; }
.cm-listen-body { flex: 1 1 auto; min-width: 0; padding: 0.6rem 0.9rem 0.85rem; }
.cm-listen-head {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4a6572;
  margin-bottom: 0.5rem;
}
.cm-listen-head span { text-transform: none; letter-spacing: 0; font-weight: 400; color: #6c757d; }
.cm-listen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem 0.75rem; }
.cm-listen-grid.cm-listen-one { grid-template-columns: 1fr; }
.cm-listen-tile {
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border-left: 3px solid #23879a;
  border-radius: 0.35rem;
  padding: 0.5rem 0.65rem 0.45rem;
  box-shadow: 0 0.2rem 0.55rem rgba(0, 0, 0, 0.2);
}
.cm-listen-label { flex: 1 1 auto; font-size: 0.88rem; line-height: 1.3; color: #6c757d; margin: 0 0 0.4rem; }
.cm-listen-label strong { color: #303840; }
.cm-listen-tile audio { display: block; width: 100%; height: 34px; }

/* Players built by cm-audio.js */
.cm-player { display: flex; align-items: center; gap: 0.6rem; }
.cm-player-btn {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background-color: #23879a;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.cm-player-btn:hover { background-color: #1b6b7a; }
.cm-player-btn:focus { outline: none; }
.cm-player-btn:focus-visible { outline: 2px solid #007aa3; outline-offset: 2px; }
.cm-player-btn svg { width: 14px; height: 14px; fill: currentColor; }
.cm-player-seek {
  flex: 1 1 auto;
  min-width: 0;
  height: 6px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 3px;
  cursor: pointer;
  background: linear-gradient(to right, #23879a var(--pct, 0%), #d9dde2 var(--pct, 0%));
}
.cm-player-seek:focus { outline: none; }
.cm-player-seek:focus-visible { outline: 2px solid #007aa3; outline-offset: 3px; }
.cm-player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #23879a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.cm-player-seek::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #23879a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.cm-player-seek::-moz-range-track { background: transparent; }
.cm-player-time {
  flex: 0 0 auto;
  min-width: 5.6em;
  text-align: right;
  font-size: 0.8rem;
  color: #6c757d;
  font-variant-numeric: tabular-nums;
}

/* Phones: the flag becomes a slim bar on top, and the tiles stack */
@media (max-width: 575.98px) {
  .cm-listen { flex-direction: column; }
  .cm-listen-flag { flex: 0 0 auto; flex-direction: row; padding: 0.35rem; }
  .cm-listen-flag .svg-inline--fa { font-size: 1rem; margin: 0 0.4rem 0 0; }
  .cm-listen-grid { grid-template-columns: 1fr; }
}
