/* Sticky podcast player — SendFlow sticky dock; tint via --player-accent (site.css). */
:root {
  --player-accent: #dceee8;
  --chalk-flax: var(--player-accent);
  --chalk-prose-width: 42rem;
}

/* SendFlow sticky Plyr player — coach briefings on plan pages */
.sendflow-sticky-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
}

.sendflow-sticky-dock.is-revealed {
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  overflow: visible;
}

/* Bottom overscroll reveal — subtle bounce into place */
@keyframes sendflow-dock-bounce-in {
  0% {
    transform: translateY(100%);
  }
  58% {
    transform: translateY(-6px);
  }
  78% {
    transform: translateY(3px);
  }
  100% {
    transform: translateY(0);
  }
}

.sendflow-sticky-dock.is-revealed.is-revealed--from-bounce {
  animation: sendflow-dock-bounce-in 0.48s cubic-bezier(0.22, 1, 0.36, 1);
  transition: none;
}

/* After dismiss (X): hide off-screen dock so bottom bounce does not peek through */
.sendflow-sticky-dock.is-dismissed:not(.is-revealed) {
  visibility: hidden;
}

.sendflow-sticky-dock[hidden]:not(.is-revealed) {
  display: none;
}

.sendflow-sticky-player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "art meta chrome"
    "plyr plyr chrome"
    "chapters chapters chapters";
  gap: 0.5rem 0.65rem;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.65rem 0.85rem calc(0.65rem + env(safe-area-inset-bottom, 0));
  background: #1a1a1a;
  color: #fff;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
  border-radius: 10px 10px 0 0;
  overflow: visible;
}

/* Hide expand/close until Plyr (or native fallback) is ready — avoids orphan chrome */
.sendflow-sticky-player:not(.is-ready) .sendflow-sticky-player__chrome {
  visibility: hidden;
  pointer-events: none;
}

.sendflow-sticky-player:not(.is-ready) .sendflow-sticky-player__plyr-wrap {
  min-height: 2.75rem;
}

.sendflow-sticky-player.is-booting:not(.is-ready) .sendflow-sticky-player__plyr-wrap::after {
  content: "Loading player…";
  display: block;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  padding: 0.35rem 0;
}

.sendflow-sticky-player__art {
  grid-area: art;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 6px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}

.sendflow-sticky-player__art:not([src]),
.sendflow-sticky-player__art[src=""] {
  visibility: hidden;
}

.sendflow-sticky-player__meta {
  grid-area: meta;
  min-width: 0;
  align-self: center;
}

.sendflow-sticky-player__show {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--player-accent, #7ec8c0);
  line-height: 1.3;
}

.sendflow-sticky-player__title {
  margin: 0.15rem 0 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  white-space: normal;
  word-break: break-word;
}

.sendflow-sticky-player__chapters {
  grid-area: chapters;
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: -0.15rem;
  max-width: 100%;
}

.sendflow-sticky-player__chapters[hidden] {
  display: none !important;
}

.sendflow-sticky-player__chapter {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0.12rem 0.4rem;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 0.68rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
}

.sendflow-sticky-player__chapter:hover,
.sendflow-sticky-player__chapter:focus-visible {
  background: var(--player-accent, #dceee8);
  color: #1a1a1a;
  outline: none;
}

.sendflow-sticky-player .plyr__progress__marker {
  background-color: var(--player-accent, #dceee8);
  width: 3px;
  height: 9px;
  border-radius: 1px;
  z-index: 4;
  cursor: pointer;
}

.sendflow-sticky-player__plyr-wrap {
  grid-area: plyr;
  min-width: 0;
  min-height: 2.5rem;
  overflow: visible;
  position: relative;
  z-index: 2;
  align-self: center;
}

.sendflow-sticky-player__audio--native {
  display: block;
  width: 100%;
  height: 2.25rem;
  color-scheme: dark;
}

.sendflow-sticky-player__chrome {
  grid-area: chrome;
  grid-row: 1 / -1;
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-self: start;
  padding-top: 0.1rem;
}

body[data-player-expand="false"] .sendflow-sticky-player__expand {
  display: none !important;
}

.sendflow-sticky-player__expand,
.sendflow-sticky-player__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.sendflow-sticky-player__expand-icon {
  display: block;
  flex-shrink: 0;
}

.sendflow-sticky-player__expand:hover,
.sendflow-sticky-player__expand:focus-visible,
.sendflow-sticky-player__close:hover,
.sendflow-sticky-player__close:focus-visible {
  background: var(--player-accent, #dceee8);
  color: #1a1a1a;
  outline: none;
}

.sendflow-sticky-player .plyr {
  --plyr-color-main: var(--player-accent, #dceee8);
  --plyr-audio-controls-background: transparent;
  --plyr-audio-control-color: #fff;
  --plyr-audio-control-color-hover: #1a1a1a;
  --plyr-audio-control-background-hover: var(--player-accent, #dceee8);
  --plyr-audio-progress-buffered-background: rgba(255, 255, 255, 0.15);
  --plyr-audio-range-track-background: rgba(255, 255, 255, 0.2);
  --plyr-font-size-time: 0.8rem;
  min-width: 0;
}

.sendflow-sticky-player .plyr__control {
  border-radius: 6px;
}

.sendflow-sticky-player .plyr__control:hover,
.sendflow-sticky-player .plyr__control:focus-visible {
  background: var(--player-accent, #dceee8);
  color: #1a1a1a;
}

.sendflow-sticky-player .plyr__controls {
  padding: 0;
  overflow: visible;
}

/* Plyr speed/settings menu opens upward — must not clip inside sticky bar */
.sendflow-sticky-player .plyr__menu__container {
  z-index: 1101;
}

body.has-sendflow-sticky-player {
  padding-bottom: 9rem;
}

body.has-sendflow-sticky-player.has-podcast-player {
  padding-bottom: 9rem;
}

/* Desktop: align with plan column (--chalk-prose-width), slightly wider for Plyr chrome */
@media (min-width: 768px) {
  .sendflow-sticky-player {
    max-width: min(100%, calc(var(--chalk-prose-width, 65ch) + 8ch));
  }
}

@media (min-width: 640px) {
  .sendflow-sticky-player {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "art meta chrome"
      "art plyr chrome"
      "art chapters chrome";
    gap: 0.2rem 0.85rem;
    padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0));
  }

  .sendflow-sticky-player__art {
    width: 4rem;
    height: 4rem;
    grid-row: 1 / span 3;
    align-self: center;
  }

  .sendflow-sticky-player__meta {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0.45rem;
    align-self: center;
    padding-bottom: 0;
    min-width: 0;
  }

  .sendflow-sticky-player__show {
    flex-shrink: 0;
    margin: 0;
  }

  .sendflow-sticky-player__show::after {
    content: "·";
    margin-left: 0.45rem;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 700;
    letter-spacing: 0;
  }

  .sendflow-sticky-player__title {
    margin: 0;
    min-width: 0;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sendflow-sticky-player__plyr-wrap {
    align-self: center;
  }

  .sendflow-sticky-player__chrome {
    align-self: center;
    padding-top: 0;
  }
}

/* —— Expand modal (listening hub) —— */
.sendflow-modal[hidden] {
  display: none;
}

.sendflow-modal:not([hidden]) {
  display: block;
}

.sendflow-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
}

.sendflow-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  cursor: pointer;
}

.sendflow-modal__sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-height: 96vh;
  max-height: 96dvh;
  background: #1a1a1a;
  color: #fff;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
  animation: sendflow-modal-slide-up 0.28s ease-out;
}

@keyframes sendflow-modal-slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.sendflow-modal__handle {
  flex-shrink: 0;
  width: 2.5rem;
  height: 4px;
  margin: 0.65rem auto 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
}

.sendflow-modal__header {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 0.35rem 0.75rem 0;
}

.sendflow-modal__close {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.sendflow-modal__close:hover,
.sendflow-modal__close:focus-visible {
  color: #fff;
  outline: 1.5px solid var(--player-accent, #7ec8c0);
  outline-offset: 2px;
}

.sendflow-modal__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 1rem 1.25rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0));
}

.sendflow-modal__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sendflow-modal__section-label {
  margin: 1rem 0 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--player-accent, #7ec8c0);
  line-height: 1.3;
}

.sendflow-modal__section-label--lg {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.sendflow-modal__now {
  margin: 0 -1rem;
  padding: 0.85rem 1rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  transition: box-shadow 0.2s ease;
}

.sendflow-modal__now--highlight {
  animation: sendflow-now-pulse 1s ease-out;
}

@keyframes sendflow-now-pulse {
  0% {
    box-shadow: inset 0 0 0 1.5px rgba(249, 223, 116, 0.85);
    background: rgba(249, 223, 116, 0.08);
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(249, 223, 116, 0);
    background: rgba(255, 255, 255, 0.04);
  }
}

.sendflow-modal__now-inner {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.sendflow-modal__now-art {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.sendflow-modal__now-text {
  min-width: 0;
}

.sendflow-modal__now-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
}

.sendflow-modal__now-show {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
}

.sendflow-modal__now-time {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.65);
}

.sendflow-modal__episode-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sendflow-modal__episode-loading,
.sendflow-modal__episode-empty {
  padding: 1rem 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}

.sendflow-modal__episode {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.52rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sendflow-modal__episode--current {
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  background: rgba(249, 223, 116, 0.1);
  border-left: 1.5px solid var(--player-accent, #7ec8c0);
  border-bottom-color: rgba(249, 223, 116, 0.15);
}

.sendflow-modal__episode--played .sendflow-modal__episode-title {
  color: rgba(255, 255, 255, 0.55);
}

.sendflow-modal__episode-art {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.sendflow-modal__episode-body {
  position: relative;
  min-width: 0;
  padding-right: 1.25rem;
}

.sendflow-modal__episode-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
}

.sendflow-modal__episode-meta {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
}

.sendflow-modal__episode-done {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.75rem;
  color: rgba(249, 223, 116, 0.75);
}

.sendflow-modal__episode-play {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}

.sendflow-modal__episode-play:focus-visible {
  outline: 1.5px solid var(--player-accent, #7ec8c0);
  outline-offset: 2px;
  border-radius: 50%;
}

.sendflow-modal .plan-preview-play__disc--sm {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  background-color: var(--player-accent, #7ec8c0);
}

.sendflow-modal .plan-preview-play__disc--sm .plan-preview-play__icon {
  width: 1rem;
  height: 1rem;
  margin-left: 0.1rem;
  color: #1a1a1a;
}

.sendflow-modal__subscribe-lead {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.65);
}

.sendflow-modal__platform-row {
  margin-bottom: 0.65rem;
}

.sendflow-modal__platform-row:last-of-type {
  margin-bottom: 0.35rem;
}

.sendflow-modal__platform-label {
  margin: 0 0 0.3rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.75);
}

.sendflow-modal__subscribe-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.sendflow-modal a.sendflow-modal__subscribe-btn,
.sendflow-modal button.sendflow-modal__subscribe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0.6rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none !important;
  color: var(--player-accent, #7ec8c0) !important;
  -webkit-text-fill-color: var(--player-accent, #7ec8c0);
  background: transparent !important;
  border: 1.5px solid var(--player-accent, #7ec8c0);
  min-height: 2.5rem;
  line-height: 1.2;
  cursor: pointer;
  font-family: inherit;
}

.sendflow-modal a.sendflow-modal__subscribe-btn:hover,
.sendflow-modal a.sendflow-modal__subscribe-btn:focus-visible,
.sendflow-modal button.sendflow-modal__subscribe-btn:hover,
.sendflow-modal button.sendflow-modal__subscribe-btn:focus-visible {
  background: var(--player-accent, #7ec8c0) !important;
  color: #1a1a1a !important;
  -webkit-text-fill-color: #1a1a1a;
  text-decoration: none !important;
}

.sendflow-modal a.sendflow-modal__subscribe-btn:active,
.sendflow-modal button.sendflow-modal__subscribe-btn:active {
  background: var(--player-accent, #7ec8c0) !important;
  color: #1a1a1a !important;
  -webkit-text-fill-color: #1a1a1a;
}

.sendflow-modal__subscribe-btn--block {
  display: flex;
  width: 100%;
  margin-top: 0.65rem;
}

.sendflow-modal__bookmark {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sendflow-modal__platform-row[hidden] {
  display: none;
}

.sendflow-modal__bookmark-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.6);
}

.sendflow-modal__bookmark-tip {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
}

.sendflow-modal__bookmark-tip[hidden] {
  display: none;
}

.sendflow-modal__subscribe-other-title {
  margin: 1.25rem 0 0.35rem;
  font-size: 0.9rem;
  color: #fff;
}

.sendflow-modal__subscribe-other-text {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.6);
}

.sendflow-modal__feed-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
  margin: 0;
}

.sendflow-modal__feed-code {
  flex: 1 1 12rem;
  min-width: 0;
  margin: 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.72rem;
  line-height: 1.4;
  word-break: break-all;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.sendflow-modal__copy {
  flex-shrink: 0;
  padding: 0.55rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1a1a1a;
  background: var(--player-accent, #7ec8c0);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.sendflow-modal__copy:hover,
.sendflow-modal__copy:focus-visible {
  opacity: 0.9;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sendflow-modal__spotify-note {
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.4);
}

body.sendflow-modal-open {
  overflow: hidden;
}

@media (min-width: 768px) {
  .sendflow-modal__sheet {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(32rem, calc(100% - 2rem));
    max-height: min(85vh, 40rem);
    border-radius: 10px;
    transform: translate(-50%, -50%);
    animation: sendflow-modal-fade-in 0.22s ease-out;
  }

  @keyframes sendflow-modal-fade-in {
    from {
      opacity: 0;
      transform: translate(-50%, -48%);
    }
    to {
      opacity: 1;
      transform: translate(-50%, -50%);
    }
  }

  .sendflow-modal__handle {
    display: none;
  }

  .sendflow-modal__subscribe-row {
    grid-template-columns: 1fr;
  }
}
