/* ============================================================
   Sermon player + sermon library (sermons.php, sermon.php)
   Uses the tokens at the top of site.css (navy, cream, gold, flame).
   ============================================================ */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.btn svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.btn svg[hidden] { display: none; }

/* ------------------------------------------------------------ player
   Desktop/tablet: a bar under the menu (inside the sticky header).
   Phones: docked to the bottom of the screen; tap it to open the controls. */
.player {
  position: relative;
  background: var(--navy-deep);
  color: var(--cream);
  border-bottom: 1px solid rgba(196,163,90,0.2);
}
.p-line { display: none; }
.p-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
}
.p-play {
  flex-shrink: 0;
  width: 2.75rem; height: 2.75rem;
  border: 0; border-radius: 999px;
  background: var(--gold); color: var(--navy-deep);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.p-play:hover { background: var(--cream); }
.p-play svg { width: 1.1rem; height: 1.1rem; }
.p-play svg[hidden], .s-play svg[hidden], .sd-play svg[hidden] { display: none !important; }
.p-play-lg { display: none; }
.p-copy {
  flex: 1; min-width: 0;
  display: block;
  padding: 0; border: 0; background: none;
  color: inherit; font: inherit; text-align: left;
  cursor: pointer;
}
.p-label { display: block; margin: 0 0 0.1rem; }
.p-title {
  display: block;
  font-family: var(--font-display); font-style: italic;
  font-size: 1.08rem; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.p-sub {
  display: block;
  font-size: 0.75rem; color: rgba(246,241,231,0.65);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.p-copy:hover .p-title { color: var(--gold); }
.p-panel { display: flex; align-items: center; gap: 0.75rem; }
.p-seek { display: flex; align-items: center; gap: 0.5rem; width: clamp(11rem, 24vw, 22rem); }
.p-seek input[type=range] { flex: 1; min-width: 0; accent-color: var(--gold); height: 0.35rem; cursor: pointer; }
.p-time {
  min-width: 2.8rem;
  font-size: 0.72rem; font-variant-numeric: tabular-nums;
  color: rgba(246,241,231,0.65);
}
.p-time:first-child { text-align: right; }
.p-buttons { display: flex; align-items: center; gap: 0.1rem; }
.p-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.5rem; height: 2.5rem; padding: 0 0.35rem;
  border: 0; background: transparent;
  color: rgba(246,241,231,0.8);
  font: inherit; font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums;
  text-decoration: none; cursor: pointer;
}
.p-btn:hover, .p-btn:focus-visible { color: var(--gold); }
.p-btn svg { width: 1.15rem; height: 1.15rem; }
.p-btn[data-p-skip] span {
  position: absolute; font-size: 0.5rem; font-weight: 700;
  top: 50%; left: 50%; transform: translate(-50%, -38%);
}
.p-btn[data-p-skip] svg { width: 1.45rem; height: 1.45rem; }
.p-rate { min-width: 2.9rem; border: 1px solid rgba(246,241,231,0.25); height: 1.8rem; margin: 0 0.25rem; }
.p-details, .p-chev, .p-close { display: none; }
.player.is-empty .p-panel { visibility: hidden; }

@media (max-width: 1023px) {
  .p-seek { width: clamp(9rem, 22vw, 14rem); }
  .p-pop { display: none; }
}

/* ---- phones: bottom dock */
@media (max-width: 767px) {
  body { padding-bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
  body.p-hidden { padding-bottom: 0; }
  .player {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    border-bottom: 0; border-top: 1px solid rgba(196,163,90,0.3);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 30px rgba(16,35,51,0.28);
  }
  .player.is-hidden { display: none; }
  .p-line { display: block; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: rgba(246,241,231,0.12); }
  .p-line span { display: block; height: 100%; width: 0; background: var(--gold); }
  .p-inner { flex-wrap: wrap; gap: 0.6rem; padding: 0.55rem 0 0.5rem; }
  .p-panel { display: none; order: 10; width: 100%; flex-direction: column; align-items: stretch; gap: 0.6rem; padding: 0.4rem 0 0.35rem; }
  .player.is-open .p-panel { display: flex; }
  .player.is-open .p-inner > .p-play { display: none; }
  .p-seek { width: 100%; }
  .p-seek input[type=range] { height: 1.75rem; }
  .p-buttons { justify-content: space-between; }
  .p-play-lg { display: inline-flex; width: 3.5rem; height: 3.5rem; }
  .p-play-lg svg { width: 1.4rem; height: 1.4rem; }
  .p-btn { min-width: 2.9rem; height: 2.9rem; }
  .p-details {
    display: block; text-align: center;
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--gold); text-decoration: none; padding: 0.5rem 0 0.25rem;
  }
  .p-chev, .p-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem; flex-shrink: 0;
    border: 0; background: transparent; color: rgba(246,241,231,0.75); cursor: pointer;
  }
  .p-chev svg, .p-close svg { width: 1.2rem; height: 1.2rem; transition: transform 0.2s; }
  .player.is-open .p-chev svg { transform: rotate(180deg); }
  .player.is-open .p-close { display: none; }
  .p-close { margin-left: -0.6rem; }
}

/* ------------------------------------------------------------ library: search + filters */
.s-section { padding-top: 2.5rem; }
.s-search {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 1rem;
}
.s-searchbox {
  display: flex; align-items: center; gap: 0.6rem;
  background: #fff;
  border: 1px solid var(--navy);
  padding-left: 0.85rem;
}
.s-searchbox > svg { width: 1.2rem; height: 1.2rem; color: var(--muted); flex-shrink: 0; }
.s-searchbox input {
  flex: 1; min-width: 0;
  height: 3rem; border: 0; outline: none; background: transparent;
  font: inherit; font-size: 1.0625rem; color: var(--ink);
}
.s-searchbox input::-webkit-search-cancel-button { cursor: pointer; }
.s-searchbox:focus-within { box-shadow: 0 0 0 3px rgba(196,163,90,0.45); }
.s-go { min-height: 3rem; border-radius: 0; }
.s-hint { margin: 0.55rem 0 0; font-size: 0.85rem; color: var(--muted); }
.s-hint a { color: var(--navy); }
.s-filters {
  display: flex; gap: 0.5rem;
  margin-top: 0.9rem;
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
          mask-image: linear-gradient(to right, #000 88%, transparent);
  padding-bottom: 0.15rem;
}
.s-filters::-webkit-scrollbar { display: none; }
.s-select {
  position: relative; flex-shrink: 0;
  display: flex; flex-direction: column;
  min-width: 8.5rem; max-width: 15rem;
  padding: 0.35rem 2rem 0.3rem 0.75rem;
  border: 1px solid var(--rule); background: #fff;
}
.s-select[hidden] { display: none; }
.s-select::after {
  content: ""; position: absolute; right: 0.8rem; top: 50%;
  width: 0.45rem; height: 0.45rem;
  border-right: 1.5px solid var(--navy); border-bottom: 1.5px solid var(--navy);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.s-select > span {
  font-size: 0.62rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.s-select select {
  appearance: none; -webkit-appearance: none;
  border: 0; background: transparent; padding: 0; margin: 0;
  font: inherit; font-size: 1rem; color: var(--ink);
  min-height: 1.6rem; cursor: pointer; outline: none;
  text-overflow: ellipsis;
}
.s-select:focus-within { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(196,163,90,0.45); }
.s-select.is-set { border-color: var(--navy); background: var(--cream); }
.s-select.is-set > span { color: var(--flame); }

/* ---- browse tabs */
.s-tabs {
  display: flex; gap: 1.5rem;
  margin: 1.75rem 0 0;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto; scrollbar-width: none;
}
.s-tabs::-webkit-scrollbar { display: none; }
.s-tabs a {
  flex-shrink: 0;
  padding: 0.75rem 0;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.s-tabs a:hover { color: var(--navy); }
.s-tabs a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--flame); }

/* ---- results */
.s-results { transition: opacity 0.15s; }
.s-results[aria-busy="true"] { opacity: 0.45; }
.s-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 1.25rem 0 0; }
.s-count { margin: 0; color: var(--muted); font-size: 0.9rem; }
.s-count strong { color: var(--navy); font-size: 1.05rem; }
.s-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.s-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 2rem; padding: 0.2rem 0.65rem;
  background: var(--navy); color: var(--cream);
  font-size: 0.85rem; text-decoration: none;
}
.s-chip:hover { background: var(--flame); }
.s-chip-kind { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.s-chip:hover .s-chip-kind { color: var(--cream); }
.s-clear { display: inline-flex; align-items: center; min-height: 2rem; font-size: 0.8rem; color: var(--flame); }

.s-list, .s-list ul, .sd-rel-list { list-style: none; margin: 0; padding: 0; }
.s-day { margin-top: 1.75rem; }
.s-day-flat { margin-top: 0; }
.section .s-day-head, .s-day-head {
  font-size: 0.72rem;
  margin: 0; padding: 0 0 0.45rem; font-style: normal; line-height: 1.4;
  font-family: var(--font-sans); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--navy);
}
.s-day-head span { color: var(--flame); margin-right: 0.35rem; }
.s-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start; gap: 0.9rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.s-play {
  width: 2.75rem; height: 2.75rem; margin-top: 0.1rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px;
  background: var(--navy); color: var(--cream); cursor: pointer;
}
.s-play svg { width: 1rem; height: 1rem; }
.s-play [data-play-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.s-play:hover { background: var(--navy-mid); }
.s-play.is-active { background: var(--flame); }
.s-title { margin: 0; font-size: 1.4rem; font-style: italic; line-height: 1.2; }
.s-title a { color: var(--navy); text-decoration: none; }
.s-title a:hover { color: var(--flame); }
.s-meta { margin: 0.25rem 0 0; font-size: 0.95rem; line-height: 1.45; }
.s-ref { color: var(--flame); font-weight: 600; text-decoration: none; }
a.s-ref:hover { text-decoration: underline; }
.s-preacher { color: var(--ink); text-decoration: none; }
.s-preacher:hover { text-decoration: underline; }
.s-dot { color: var(--muted); margin: 0 0.15rem; }
.s-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; margin: 0.35rem 0 0; font-size: 0.78rem; color: var(--muted); }
.s-svc { color: var(--gold); font-weight: 700; letter-spacing: 0.08em; }
.s-series { color: var(--navy); border: 1px solid var(--rule); padding: 0 0.45rem; text-decoration: none; background: var(--paper); }
.s-series:hover { border-color: var(--navy); }
.s-progress { color: var(--flame); font-weight: 600; }
.s-progress[hidden] { display: none; }
.s-actions { display: flex; }
.s-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.s-icon svg { width: 1.05rem; height: 1.05rem; }
.s-icon span:empty { display: none; }
.s-icon:hover { color: var(--navy); }
.s-more-wrap { text-align: center; margin: 2rem 0 0; }
.s-empty { margin-top: 1.5rem; padding: 1.5rem; border: 1px solid var(--rule); background: var(--paper); }
.s-empty-title { font-family: var(--font-display); font-style: italic; font-size: 1.5rem; color: var(--navy); margin: 0 0 0.4rem; }

/* ---- continue listening */
.s-continue { margin-top: 1.5rem; }
.s-continue[hidden] { display: none; }
.s-continue-list { display: grid; gap: 0.6rem; margin: 0.6rem 0 0; padding: 0; list-style: none; }
.s-continue-card {
  display: grid; grid-template-columns: auto minmax(0,1fr); gap: 0.75rem; align-items: center;
  padding: 0.75rem 0.9rem; background: var(--navy); color: var(--cream);
}
.s-continue-card .s-play { background: var(--gold); color: var(--navy-deep); margin: 0; }
.s-continue-card p { margin: 0; }
.s-continue-title { font-family: var(--font-display); font-style: italic; font-size: 1.15rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-continue-sub { font-size: 0.78rem; color: rgba(246,241,231,0.7); }
.s-continue-bar { height: 3px; background: rgba(246,241,231,0.15); margin-top: 0.4rem; }
.s-continue-bar span { display: block; height: 100%; background: var(--gold); }

/* ---- browse: books, preachers, series */
.section .s-browse-head, .section .sd-rel-head { font-style: normal; line-height: 1.4; font-size: 0.72rem; }
.section .s-browse-head { margin: 2rem 0 0.75rem; }
.section .sd-rel-head { margin: 0; }
.s-browse-head { font-family: var(--font-sans); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 2rem 0 0.75rem; }
.s-books, .s-cards { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); margin: 0; padding: 0; list-style: none; }
.s-cards { margin-top: 1.5rem; }
.s-book, .s-cards a { border: 1px solid var(--rule); background: var(--paper); padding: 1rem 1.1rem; }
.s-book-name { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-family: var(--font-display); font-style: italic; font-size: 1.5rem; color: var(--navy); text-decoration: none; }
.s-book-name span, .s-card-meta { font-family: var(--font-sans); font-style: normal; font-size: 0.78rem; color: var(--muted); }
.s-book-name:hover { color: var(--flame); }
.s-chapters { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.6rem 0 0; }
.s-chapters a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.25rem; height: 2.25rem; padding: 0 0.3rem;
  border: 1px solid var(--rule); background: #fff;
  font-size: 0.85rem; color: var(--navy); text-decoration: none; font-variant-numeric: tabular-nums;
}
.s-chapters a:hover { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.s-cards a { display: block; text-decoration: none; }
.s-cards a:hover { border-color: var(--navy); }
.s-card-title { display: block; font-family: var(--font-display); font-style: italic; font-size: 1.45rem; color: var(--navy); line-height: 1.2; }

.s-subscribe { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); font-size: 0.92rem; }
.s-subscribe p { margin: 0.4rem 0 0; }
.s-subscribe code { font-size: 0.85rem; background: var(--paper); border: 1px solid var(--rule); padding: 0.1rem 0.4rem; overflow-wrap: anywhere; }
.s-copy { border: 0; background: none; color: var(--flame); font: inherit; font-weight: 600; cursor: pointer; padding: 0.25rem 0.4rem; }

/* ------------------------------------------------------------ one sermon (sermon.php) */
.sd-hero { background: var(--navy); color: var(--cream); }
.sd-hero-inner { padding: 3rem 0 2.5rem; }
.sd-hero .eyebrow a { color: inherit; text-decoration: none; }
.sd-hero .eyebrow a:hover { color: var(--cream); }
.sd-hero h1 { color: var(--cream); font-style: italic; font-size: var(--text-title); margin: 0.6rem 0 0; }
.sd-meta { margin: 0.6rem 0 0; font-size: 1.1rem; color: rgba(246,241,231,0.85); }
.sd-meta a { color: var(--gold); text-decoration: none; }
.sd-meta a:hover { text-decoration: underline; }
.sd-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.6rem; }
.sd-play { min-width: 12rem; }
.sd-play.is-active { background: var(--cream); }
.sd-btn span:empty { display: none; }
.sd-resume { margin: 0.9rem 0 0; font-size: 0.85rem; color: rgba(246,241,231,0.75); }
.sd-resume button { border: 0; background: none; color: var(--gold); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }
.sd-grid { display: grid; gap: 2.5rem; }
.sd-desc { font-size: 1.05rem; margin-bottom: 1.5rem; }
.sd-facts { margin: 0; border-top: 1px solid var(--rule); }
.sd-facts div { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--rule); }
.sd-facts dt { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); padding-top: 0.2rem; }
.sd-facts dd { margin: 0; }
.sd-facts a { color: var(--navy); }
.sd-read { display: inline-flex; align-items: center; gap: 0.3rem; margin-left: 0.6rem; font-size: 0.8rem; font-weight: 600; color: var(--flame) !important; text-decoration: none; }
.sd-read svg { width: 0.95rem; height: 0.95rem; }
.sd-rel + .sd-rel { margin-top: 2.25rem; }
.sd-rel-head { font-family: var(--font-sans); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 0; padding-bottom: 0.45rem; border-bottom: 1px solid var(--navy); }
.sd-rel .s-title { font-size: 1.2rem; }
.sd-rel-all { display: inline-block; margin-top: 0.6rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--flame); text-decoration: none; }

/* toast (share / copy feedback) */
.grpc-toast {
  position: fixed; left: 50%; bottom: calc(5.5rem + env(safe-area-inset-bottom)); z-index: 80;
  transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--cream); padding: 0.6rem 1rem; font-size: 0.9rem;
  transition: opacity 0.2s, transform 0.2s;
}
.grpc-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 768px) {
  .s-search { padding: 1.25rem 1.25rem 1rem; }
  .s-filters { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .s-item { gap: 1.1rem; padding: 1.15rem 0; }
  .s-title { font-size: 1.55rem; }
  .s-continue-list { grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
  .grpc-toast { bottom: 2rem; }
}
@media (min-width: 1024px) {
  .sd-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 4rem; }
  .sd-hero-inner { padding: 4rem 0 3rem; }
}
@media (max-width: 479px) {
  .s-go { padding: 0 1rem; }
  .s-item { gap: 0.75rem; }
  .s-actions { flex-direction: column; margin-right: -0.5rem; }
  .s-title { font-size: 1.28rem; }
}
/* Sermons page: a short banner on phones so the search box is on the first screen */
@media (max-width: 767px) {
  .page-hero.is-tight .page-hero-inner { padding: 1.6rem 0 1.4rem; }
  .page-hero.is-tight h1 { font-size: 2.2rem; margin: 0.2rem 0 0; }
  .page-hero.is-tight .lede { font-size: 0.95rem; margin-top: 0.4rem; }
  .page-hero.is-tight .gold-rule { display: none; }
  .s-section { padding-top: 1.25rem; }
  .s-search { padding: 0.75rem; }
}
@media (max-width: 479px) {
  .s-go { display: none; }          /* results update as you type; the keyboard has a Search key */
  .s-hint { font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .p-chev svg, .s-results, .grpc-toast { transition: none; }
}
