/* ==========================================================================
   Bowery Boys Episode Index — v1.6.4
   ========================================================================== */

/* --------------------------------------------------------------------------
   Page-level overrides
   These rules are safe without a body-class scope because this stylesheet
   is only ever enqueued on the page that contains the shortcode.
   -------------------------------------------------------------------------- */

/* Hide the WP page title */
.entry-header, .page-header { display: none !important; }

/* Break out of the theme's content-width container */
.entry-content,
.entry-content > .wp-block-shortcode {
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Suppress AdSense */
ins.adsbygoogle,
.adsbygoogle,
[id^="google_ads_iframe"],
[id^="div-gpt-ad"],
.google-auto-placed { display: none !important; }

.bb-ei {
  /* Palette — light main area */
  --bb-bg:          #f5f0e8;   /* warm cream                     */
  --bb-bg-dark:     #0d0c0a;   /* near-black for header/controls */
  --bb-text:        #1c1814;   /* dark warm body text            */
  --bb-text-dim:    #6a5e52;
  --bb-text-faint:  #a89e92;
  --bb-gold:        #c8973c;
  --bb-gold-bright: #dea84a;
  --bb-border:      #ddd8ce;
  --bb-rule:        #ccc7bc;
  --bb-serif:       'Playfair Display', Georgia, 'Times New Roman', serif;
  --bb-sans:        system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  background: var(--bb-bg);
  color: var(--bb-text);
  font-family: var(--bb-sans);
  width: 100%;
  max-width: 1360px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  padding-bottom: 80px;
}

/* --------------------------------------------------------------------------
   Masthead — stays dark
   -------------------------------------------------------------------------- */
.bb-ei-masthead {
  background: #7d0019;
  text-align: center;
  padding: 52px 32px 44px;
}

.bb-ei-masthead__rule {
  height: 4px;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.55)   0,   rgba(255,255,255,0.55)   2px,
    transparent              2px, transparent              3px,
    rgba(255,255,255,0.15)   3px, rgba(255,255,255,0.15)   4px
  );
  margin: 22px auto;
  max-width: 520px;
}

.bb-ei-masthead__kicker {
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 14px;
  font-weight: 600;
}

.bb-ei-masthead__title {
  font-family: var(--bb-serif);
  font-size: clamp(32px, 5.5vw, 68px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.bb-ei-masthead__meta {
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin: 18px 0 0;
}

.bb-ei-masthead__dot {
  margin: 0 8px;
  color: rgba(255, 255, 255, 0.35);
}

/* --------------------------------------------------------------------------
   Controls bar — dark red, sticky
   -------------------------------------------------------------------------- */
.bb-ei-controls {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #62001A;
  border-bottom: 2px solid #46000f;
  padding: 14px 32px;
}

.bb-ei-controls__row {
  display: flex;
  gap: 0;
  align-items: center;
  flex-wrap: wrap;
}

.bb-ei-controls__row > * + * {
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  padding-left: 24px;
  margin-left: 24px;
}

/* Search — light box so text is always readable */
.bb-ei-search-wrap {
  position: relative;
  flex: 1 1 200px;
  display: flex;
  align-items: center;
  min-width: 0;
  background: rgba(255, 255, 255, 0.93);
  border-radius: 3px;
  padding: 0 10px;
}

.bb-ei-search-icon {
  position: relative;
  left: auto;
  width: 16px;
  height: 16px;
  color: #7a6e68;
  pointer-events: none;
  flex-shrink: 0;
  margin-right: 8px;
}

.bb-ei-search {
  flex: 1;
  padding: 8px 8px 8px 0;
  font-size: 15px;
  font-family: var(--bb-sans);
  border: none;
  background: transparent;
  color: #1c1814;
  -webkit-text-fill-color: #1c1814;
  caret-color: #C41230;
  -webkit-appearance: none;
  appearance: none;
}

.bb-ei-search:focus        { outline: none; }
.bb-ei-search::placeholder { color: #8a7d70; font-style: italic; }
.bb-ei-search::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Gold ring on focus */
.bb-ei-search-wrap:focus-within {
  outline: 2px solid var(--bb-gold);
  outline-offset: 0;
}

/* Selects — bordered pill on deep burgundy */
.bb-ei-select {
  padding: 7px 32px 7px 12px;
  font-size: 13px;
  font-family: var(--bb-sans);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23ffffff' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round' opacity='.55'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.bb-ei-select:hover {
  background-color: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
}
.bb-ei-select:focus {
  outline: none;
  background-color: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
}
.bb-ei-select.bb-active {
  color: var(--bb-gold-bright);
  border-color: rgba(200, 151, 60, 0.55);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23dea84a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Clear button — bordered pill on deep burgundy */
.bb-ei-clear {
  padding: 7px 12px;
  font-size: 11px;
  font-family: var(--bb-sans);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.bb-ei-clear:hover,
.bb-ei-clear:focus {
  background-color: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
  outline: none;
}

/* Episode count — light on dark red */
.bb-ei-count {
  margin: 10px 0 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}
.bb-ei-count strong { color: rgba(255, 255, 255, 0.72); font-weight: 600; }

/* --------------------------------------------------------------------------
   Grid — light cream area begins here
   -------------------------------------------------------------------------- */
.bb-ei-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--bb-rule);     /* 2px warm-gray lines between cards */
  border-top: 2px solid var(--bb-rule);
  border-bottom: 2px solid var(--bb-rule);
}

@media (max-width: 900px) {
  .bb-ei-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 540px) {
  .bb-ei-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

/* The [hidden] attribute is the single source of truth for visibility.
   No CSS !important conflicts — just a clean override. */
.bb-ei-card[hidden] { display: none !important; }

.bb-ei-card {
  background: #1c1814;   /* dark backing behind image */
  overflow: hidden;
  display: block;
  border-left: 3px solid transparent;
  transition: border-left-color 0.2s ease;
}
.bb-ei-card:hover { border-left-color: var(--bb-gold); }

.bb-ei-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.bb-ei-card__link:focus-visible {
  outline: 2px solid var(--bb-gold);
  outline-offset: -2px;
}

/* Thumbnail fills the card — text lives inside via overlay */
.bb-ei-card__thumb {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  display: block;
}

.bb-ei-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.88) saturate(0.85);
  transition: transform 0.5s ease, filter 0.5s ease;
}
.bb-ei-card:hover .bb-ei-card__thumb img {
  transform: scale(1.05);
  filter: brightness(1) saturate(1);
}

/* Gradient overlay — always dark enough to keep white text readable */
.bb-ei-card__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 56px 16px 14px;
  background: linear-gradient(
    to bottom,
    transparent              0%,
    rgba(0, 0, 0, 0.30)     30%,
    rgba(0, 0, 0, 0.78)     62%,
    rgba(0, 0, 0, 0.97)    100%
  );
}

/* Episode number — pill badge pinned to top-left corner of the image */
.bb-ei-card__ep-num {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(98, 0, 26, 0.92);   /* site burgundy, slightly translucent */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #ffffff;
  font-family: var(--bb-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 3px;
  pointer-events: none;
  user-select: none;
}

/* Headline — title now sits at top of overlay (above cats/date) */
.bb-ei-card__title {
  font-family: var(--bb-serif);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: #ffffff;
  margin: 0 0 8px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s ease;
}
.bb-ei-card:hover .bb-ei-card__title { color: #f5e4b8; }

/* Footer row: categories + date sit together at the bottom */
.bb-ei-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* Category label */
.bb-ei-card__cats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}
.bb-ei-cat {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bb-gold);
  white-space: nowrap;
}
.bb-ei-cat + .bb-ei-cat::before {
  content: '\00B7';
  color: rgba(255, 255, 255, 0.3);
  font-weight: 400;
  margin: 0 5px;
}

/* Dateline */
.bb-ei-card__date {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0;
  flex-shrink: 0;
  margin-left: auto;
}

/* Placeholder (no image) */
.bb-ei-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1a1512;
  background-image: radial-gradient(circle, rgba(200,151,60,0.07) 1px, transparent 1px);
  background-size: 12px 12px;
  font-family: var(--bb-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: rgba(200, 151, 60, 0.25);
}

/* --------------------------------------------------------------------------
   View toggle
   -------------------------------------------------------------------------- */
.bb-ei-view-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.bb-ei-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.bb-ei-view-btn:hover {
  background-color: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
}
.bb-ei-view-btn[aria-pressed="true"] {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
  color: #ffffff;
}
.bb-ei-view-btn:focus { outline: none; }

/* --------------------------------------------------------------------------
   List view
   The key: we turn .bb-ei-card__thumb into a flex row so the image and
   overlay become siblings inside it. We also set position:static on the
   thumb so it's not a positioned containing block, allowing the overlay
   to use position:static and flow naturally as a flex child.
   -------------------------------------------------------------------------- */
.bb-ei-grid.bb-ei-list {
  display: block;
  background: transparent;
  border-top: 2px solid var(--bb-rule);
  border-bottom: 2px solid var(--bb-rule);
}

.bb-ei-grid.bb-ei-list .bb-ei-card {
  background: var(--bb-bg);
  border-left: none;
  border-bottom: 1px solid var(--bb-rule);
  transition: background 0.15s;
}
.bb-ei-grid.bb-ei-list .bb-ei-card:last-child { border-bottom: none; }
.bb-ei-grid.bb-ei-list .bb-ei-card:hover { background: #ede8de; border-left: none; }

.bb-ei-grid.bb-ei-list .bb-ei-card__link {
  display: block;
  padding: 0;
}

/* Thumb becomes the flex row: image left, overlay right */
.bb-ei-grid.bb-ei-list .bb-ei-card__thumb {
  position: relative;       /* keeps badge anchored; overlay is position:static in list mode so no clip issue */
  display: flex;
  flex-direction: row;
  align-items: stretch;
  aspect-ratio: unset;
  height: auto;
  min-height: 80px;
  overflow: hidden;
}

/* Image: fixed-width column on the left */
.bb-ei-grid.bb-ei-list .bb-ei-card__thumb > img,
.bb-ei-grid.bb-ei-list .bb-ei-card__thumb > .bb-ei-card__placeholder {
  flex-shrink: 0;
  width: 120px;
  height: auto;
  min-height: 80px;
  align-self: stretch;
  object-fit: cover;
  filter: none;
  position: static;
}

/* Overlay: flex child that fills the rest of the row */
.bb-ei-grid.bb-ei-list .bb-ei-card__overlay {
  position: static;         /* back in normal flow as a flex child */
  background: none;
  padding: 12px 20px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

/* Episode badge on the small list-mode thumbnail */
.bb-ei-grid.bb-ei-list .bb-ei-card__ep-num {
  top: 6px;
  left: 6px;
  font-size: 10px;
  padding: 3px 7px;
}

/* Title: dark text on cream background */
.bb-ei-grid.bb-ei-list .bb-ei-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--bb-text);
  text-shadow: none;
  -webkit-line-clamp: 2;
  margin-bottom: 0;
}
.bb-ei-grid.bb-ei-list .bb-ei-card:hover .bb-ei-card__title { color: var(--bb-text); }

/* Footer row in list mode */
.bb-ei-grid.bb-ei-list .bb-ei-card__footer {
  flex-wrap: nowrap;
  gap: 12px;
}

/* Cats: smaller, muted on cream */
.bb-ei-grid.bb-ei-list .bb-ei-cat { color: var(--bb-text-dim); font-size: 9px; }
.bb-ei-grid.bb-ei-list .bb-ei-cat + .bb-ei-cat::before { color: var(--bb-rule); }

/* Date: right-aligned */
.bb-ei-grid.bb-ei-list .bb-ei-card__date {
  color: var(--bb-text-faint);
  margin-left: auto;
  flex-shrink: 0;
  text-align: right;
}

/* No image hover effects in list mode */
.bb-ei-grid.bb-ei-list .bb-ei-card__thumb > img { transition: none; }
.bb-ei-grid.bb-ei-list .bb-ei-card:hover .bb-ei-card__thumb > img {
  transform: none;
  filter: none;
}

/* --------------------------------------------------------------------------
   Load More
   -------------------------------------------------------------------------- */
.bb-ei-loadmore {
  background: var(--bb-bg);
  border-top: 2px solid var(--bb-rule);
  text-align: center;
  padding: 40px 24px;
}

.bb-ei-loadmore-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #62001A;
  border: 1px solid #46000f;
  color: rgba(255, 255, 255, 0.85);
  padding: 16px 48px;
  font-family: var(--bb-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.bb-ei-loadmore-btn:hover,
.bb-ei-loadmore-btn:focus {
  background: #7d001f;
  border-color: #62001A;
  color: #ffffff;
  outline: none;
}

.bb-ei-loadmore-remaining {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
  text-transform: none;
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */
.bb-ei-empty {
  text-align: center;
  padding: 80px 24px;
}
.bb-ei-empty p {
  font-family: var(--bb-serif);
  font-style: italic;
  font-size: 22px;
  color: var(--bb-text-dim);
  margin: 0 0 20px;
}
.bb-ei-empty .bb-ei-clear {
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--bb-gold);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--bb-gold);
  border-radius: 0;
  padding: 0 0 2px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .bb-ei-masthead { padding: 36px 20px 30px; }
  .bb-ei-controls { position: static; padding: 14px 20px; }

  .bb-ei-controls__row { flex-direction: column; align-items: stretch; }
  .bb-ei-controls__row > * + * {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-left: 0;
    margin-left: 0;
    padding-top: 12px;
    margin-top: 12px;
  }
  .bb-ei-select,
  .bb-ei-clear { width: 100%; }

  /* List view: tighter thumbnail on mobile */
  .bb-ei-grid.bb-ei-list .bb-ei-card__thumb > img,
  .bb-ei-grid.bb-ei-list .bb-ei-card__thumb > .bb-ei-card__placeholder { width: 80px; min-height: 60px; }
  .bb-ei-grid.bb-ei-list .bb-ei-card__overlay { padding: 10px 14px; }
  .bb-ei-grid.bb-ei-list .bb-ei-card__footer { flex-wrap: wrap; }
  .bb-ei-grid.bb-ei-list .bb-ei-card__date { margin-left: 0; text-align: left; }
}
