/* ==========================================================================
   EPISODES — YouTube card grid
   ========================================================================== */

.episodes { background: var(--paper); padding: clamp(4.5rem, 10vh, 8rem) 0; position: relative; }

.episodes-inner {
  max-width: var(--w-wide);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

.episodes-head { margin-bottom: 2rem; }
.episodes-head .section-title { margin-top: 1.2rem; }
.episodes-head .section-title em { display: inline-block; }

/* ─── Search + filter controls ─── */
.episodes-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 2.6rem;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid var(--line-light);
  border-radius: 3px;
  flex-wrap: wrap;
}

.ep-filters {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
  background: var(--sand);
  padding: 0.28rem;
  border-radius: 2px;
  position: relative;
}

.ep-filter-pill {
  position: absolute;
  top: 0.28rem;
  left: 0;
  height: calc(100% - 0.56rem);
  width: 0;
  background: var(--orange);
  border-radius: 2px;
  transition: transform 0.32s var(--ease-out), width 0.32s var(--ease-out);
  pointer-events: none;
  z-index: 0;
}

.ep-filter {
  position: relative;
  z-index: 1;
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--taupe);
  background: transparent;
  border: none;
  border-radius: 2px;
  padding: 0.52rem 1.05rem;
  cursor: pointer;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.ep-filter:hover { color: var(--espresso); }

.ep-filter.is-active {
  color: #fff4ea;
}

.ep-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 180px;
  max-width: 300px;
  background: transparent;
  border: 1px solid var(--line-light);
  border-radius: 2px;
  padding: 0.58rem 1.1rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.ep-search-wrap:focus-within {
  border-color: var(--orange);
  background: transparent;
}

.ep-search-icon {
  position: static;
  color: var(--taupe);
  pointer-events: none;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.ep-search-input {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--espresso);
  background: transparent;
  border: none;
  border-radius: 0;
  width: 100%;
  padding: 0;
  outline: none;
  -webkit-appearance: none;
}

.ep-search-input::placeholder { color: var(--taupe); }

/* hide browser-native clear button */
.ep-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* No results message */
.ep-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 0;
  font-size: 0.9rem;
  color: var(--taupe);
  letter-spacing: 0.04em;
}

@media (max-width: 560px) {
  .episodes-controls {
    flex-direction: column;
    align-items: stretch;
    border-radius: 3px;
    padding: 0.6rem;
    gap: 0.5rem;
  }
  .ep-search-wrap { max-width: 100%; width: 100%; order: -1; }
  .ep-filters { width: 100%; justify-content: space-between; }
  .ep-filter { flex: 1; text-align: center; }
}

/* ─── Card grid ─── */
.episodes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.4rem 1.8rem;
}

.ep-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  position: relative;
}

/* Thumbnail */
.ep-thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 2px;
  background: var(--sand);
  position: relative;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.ep-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease-out);
}

.ep-card:hover .ep-thumb img { transform: scale(1.04); }

/* Hover overlay + play button */
.ep-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(25, 18, 12, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.ep-card:hover .ep-thumb-overlay { background: rgba(25, 18, 12, 0.38); }

.ep-play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.78);
  transition: opacity 0.28s ease, transform 0.35s var(--ease-out);
  flex-shrink: 0;
}

.ep-card:hover .ep-play { opacity: 1; transform: scale(1); }

.ep-play svg { margin-left: 3px; }

/* Placeholder thumb (no image) */
.ep-thumb-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, rgba(0,0,0,0.035) 14px 15px),
    var(--sand);
}

.ep-ph-label {
  font-size: 0.6rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--taupe);
  text-align: center;
  padding: 0 1rem;
  line-height: 1.6;
}

/* Card body */
.ep-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ep-eyebrow {
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 0.38rem;
  font-variant-numeric: tabular-nums;
}

.ep-title {
  font-family: var(--font-display);
  font-weight: 470;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.26;
  letter-spacing: -0.01em;
  color: var(--espresso);
  transition: color 0.22s ease;
}

.ep-card:hover .ep-title { color: var(--orange-deep); }

.ep-foot {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 0.7rem;
  row-gap: 0.15rem;
  margin-top: 0.4rem;
}

.ep-byline {
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--taupe);
}

.ep-date {
  font-size: 0.66rem;
  color: var(--taupe);
  opacity: 0.75;
  margin-left: auto;
  white-space: nowrap;
}

/* Shimmer loading */
@keyframes ep-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ep-card.is-loading .ep-thumb {
  background:
    linear-gradient(90deg, var(--sand) 25%, var(--line-light) 50%, var(--sand) 75%);
  background-size: 200% 100%;
  animation: ep-shimmer 1.4s infinite;
}

/* Section footer */
.episodes-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line-light);
}

.episodes-foot p {
  font-size: 0.95rem;
  color: #4b3b2d;
}

.episodes-foot em {
  font-family: var(--font-display);
  color: var(--orange-deep);
}

.episodes-foot-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.episodes-foot-actions .btn[disabled] {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

@media (min-width: 561px) {
  .episodes-foot-actions .btn {
    box-sizing: border-box;
    line-height: 1;
  }
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .episodes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .episodes-grid { grid-template-columns: minmax(0, 1fr); gap: 1.8rem; }

  .episodes-foot-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .episodes-foot-actions .btn { text-align: center; justify-content: center; }
}

/* ─── Episode modal ─── */
.ep-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.ep-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.ep-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 13, 8, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ep-modal-panel {
  position: relative;
  width: 100%;
  max-width: 820px;
  background: var(--espresso);
  border-radius: 3px;
  overflow: hidden;
  transform: translateY(22px) scale(0.97);
  transition: transform 0.38s var(--ease-out);
  box-shadow: 0 32px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(246,236,221,0.06);
}

.ep-modal.is-open .ep-modal-panel {
  transform: translateY(0) scale(1);
}

.ep-modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 10;
  background: rgba(0,0,0,0.42);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--cream-on-dark);
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.ep-modal-close:hover { background: rgba(0,0,0,0.68); }

.ep-modal-player {
  aspect-ratio: 16 / 9;
  background: #000;
  display: block;
}

.ep-modal-player iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}

.ep-modal-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ep-modal-placeholder span {
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
}

.ep-modal-info {
  padding: 1.3rem 1.7rem 1.55rem;
}

.ep-modal-date {
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 0.45rem;
  font-variant-numeric: tabular-nums;
}

.ep-modal-title {
  font-family: var(--font-display);
  font-weight: 460;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  line-height: 1.24;
  letter-spacing: -0.01em;
  color: var(--cream-on-dark);
  margin-bottom: 0.45rem;
}

.ep-modal-channel {
  font-size: 0.76rem;
  color: var(--muted-on-dark);
  letter-spacing: 0.04em;
}

@media (max-width: 560px) {
  .ep-modal-info { padding: 1rem 1.15rem 1.25rem; }
}
