/* ---------------------------------------------------------------
   Between Words — reusable media components
   Player + bilingual transcript reader. Load after style.css.
--------------------------------------------------------------- */

/* Shared page surface -------------------------------------------- */
.bw-component-page {
  min-height: 100vh;
}

.bw-component-top {
  border-bottom: 1px solid var(--line);
}

.bw-component-top .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.3rem 0;
}

.bw-component-back {
  color: var(--ink-soft);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.bw-component-back:hover {
  color: var(--green);
}

.bw-component-main {
  padding: clamp(3rem, 6vw, 6rem) 0 clamp(5rem, 9vw, 8rem);
}

.bw-component-intro {
  max-width: 48rem;
}

.bw-component-intro h1 {
  margin-top: 0.8rem;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 5.8rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.bw-component-intro h1 em {
  color: var(--green);
  font-weight: 400;
}

.bw-component-intro .lede {
  max-width: 54ch;
  margin-top: 1.2rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.8;
}

.bw-component-section {
  margin-top: clamp(3.5rem, 7vw, 6.5rem);
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-strong);
}

.bw-component-foot-note {
  margin-top: 2.5rem;
  color: var(--ink-soft);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.bw-component-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem 1.5rem;
  margin-bottom: 1.5rem;
}

.bw-component-section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.bw-component-section-head p {
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-style: italic;
}

/* Audio player ---------------------------------------------------- */
.bw-player {
  --bw-progress: 0%;
  --bw-accent: var(--green);
  width: 100%;
}

.bw-player-shell {
  position: relative;
  overflow: hidden;
  padding: clamp(1.35rem, 3vw, 2.2rem);
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(28rem 20rem at 106% -10%, rgba(179, 154, 104, 0.13), transparent 65%),
    var(--paper-light);
  box-shadow: 0 1.8rem 3.6rem -3rem rgba(48, 47, 43, 0.4);
}

.bw-player-shell::after {
  content: "AUDIO";
  position: absolute;
  right: 0.04em;
  bottom: -0.28em;
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(5rem, 11vw, 9rem);
  font-style: italic;
  line-height: 0.75;
  -webkit-text-stroke: 1px rgba(49, 72, 58, 0.1);
  pointer-events: none;
  user-select: none;
}

.bw-player-head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem 1.5rem;
}

.bw-player-kicker {
  color: var(--green);
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  line-height: 1.4;
  text-transform: uppercase;
}

.bw-player-title {
  margin-top: 0.55rem;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3.2vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.bw-player-state {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.44rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.bw-player-state::before {
  content: "";
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--gold);
}

.bw-player.is-playing .bw-player-state::before {
  background: var(--green);
  box-shadow: 0 0 0 0.2rem rgba(49, 72, 58, 0.1);
}

.bw-player.is-empty .bw-player-state::before {
  background: var(--line-strong);
}

.bw-player-controls {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.4rem);
  margin-top: clamp(1.22rem, 2.5vw, 1.8rem);
}

.bw-play {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: clamp(3.6rem, 6vw, 4.3rem);
  height: clamp(3.6rem, 6vw, 4.3rem);
  padding: 0;
  border: 1px solid var(--green);
  border-radius: 50%;
  background: var(--green);
  color: var(--paper-light);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.3s var(--ease);
}

.bw-play:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  transform: scale(1.025);
}

.bw-play:disabled {
  cursor: not-allowed;
  opacity: 0.28;
}

.bw-play svg {
  width: 1.05rem;
  height: 1.05rem;
}

.bw-play .bw-icon-pause {
  display: none;
}

.bw-player.is-playing .bw-play .bw-icon-play {
  display: none;
}

.bw-player.is-playing .bw-play .bw-icon-pause {
  display: block;
}

.bw-player-progress {
  flex: 1;
  min-width: 0;
}

.bw-seek {
  display: block;
  width: 100%;
  height: 1.4rem;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.bw-seek:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.bw-seek::-webkit-slider-runnable-track {
  height: 1px;
  background: linear-gradient(to right, var(--bw-accent) 0%, var(--bw-accent) var(--bw-progress), var(--line-strong) var(--bw-progress), var(--line-strong) 100%);
}

.bw-seek::-moz-range-track {
  height: 1px;
  background: var(--line-strong);
}

.bw-seek::-moz-range-progress {
  height: 1px;
  background: var(--bw-accent);
}

.bw-seek::-webkit-slider-thumb {
  width: 0.7rem;
  height: 0.7rem;
  margin-top: -0.33rem;
  border: 2px solid var(--paper-light);
  border-radius: 50%;
  background: var(--bw-accent);
  box-shadow: 0 0 0 1px var(--bw-accent);
  appearance: none;
  -webkit-appearance: none;
}

.bw-seek::-moz-range-thumb {
  width: 0.65rem;
  height: 0.65rem;
  border: 2px solid var(--paper-light);
  border-radius: 50%;
  background: var(--bw-accent);
  box-shadow: 0 0 0 1px var(--bw-accent);
}

.bw-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.bw-time span:last-child {
  color: var(--ink-soft);
}

.bw-player-status {
  position: relative;
  z-index: 1;
  min-height: 1.1rem;
  margin-top: 0.85rem;
  color: var(--burgundy);
  font-family: var(--font-hand);
  font-size: 1.02rem;
  line-height: 1.1;
}

.bw-player-status:empty {
  display: none;
}

/* Bilingual transcript reader ----------------------------------- */
.bw-reader {
  border: 1px solid var(--line-strong);
  background: var(--paper-light);
}

.bw-reader-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: clamp(1.2rem, 2.6vw, 1.8rem) clamp(1.2rem, 3vw, 2.2rem);
  border-bottom: 1px solid var(--line);
}

.bw-reader-kicker {
  color: var(--green);
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  line-height: 1.4;
  text-transform: uppercase;
}

.bw-reader-title {
  margin-top: 0.45rem;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.7vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.bw-reader-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
}

.bw-reader-tab {
  min-height: 2.2rem;
  padding: 0.48rem 0.7rem;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.bw-reader-tab:hover {
  color: var(--green);
}

.bw-reader-tab[aria-selected="true"] {
  background: var(--green);
  color: var(--paper-light);
}

.bw-reader-panel {
  padding: clamp(1.4rem, 3.2vw, 2.4rem) clamp(1.2rem, 3vw, 2.2rem) clamp(1.8rem, 4vw, 2.8rem);
}

.bw-reader-panel[hidden] {
  display: none;
}

.bw-transcript-body {
  max-width: 65ch;
}

.bw-transcript-body[hidden] {
  display: none;
}

.bw-transcript-body p {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.9;
}

.bw-transcript-body p + p {
  margin-top: 1.05rem;
}

.bw-transcript-body:lang(zh) p,
.bw-transcript-body p[lang="zh-Hans"] {
  font-family: var(--font-cn);
  line-height: 2;
}

.bw-transcript-empty {
  display: grid;
  place-items: center;
  gap: 0.4rem;
  min-height: 11.5rem;
  padding: 1.5rem 0;
  text-align: center;
}

.bw-transcript-empty strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.bw-transcript-empty span {
  color: var(--ink-soft);
  font-family: var(--font-hand);
  font-size: 1.15rem;
  line-height: 1.1;
}

.bw-transcript-empty small {
  color: var(--gold);
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

@media (max-width: 560px) {
  .bw-player-controls {
    align-items: flex-start;
  }

  .bw-player-shell::after {
    font-size: 5rem;
  }

  .bw-player-state {
    padding-top: 0;
  }

  .bw-reader-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .bw-reader-tabs {
    width: 100%;
  }

  .bw-reader-tab {
    flex: 1;
  }
}
