/* AS Podcast – Frontend Styles */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Hanken+Grotesk:wght@400;500;600&display=swap');

:root {
  --km-bg:       #0E0E10;
  --km-bg2:      #18181b;
  --km-bg3:      #1f1f23;
  --km-border:   #2a2a30;
  --km-text:     #e4e4e7;
  --km-muted:    #71717a;
  --km-red:      #E8132B;
  --km-green:    #1DB954;
  --km-radius:   12px;
}

.km-podcast * { box-sizing: border-box; margin: 0; padding: 0; }

.km-podcast {
  font-family: 'Hanken Grotesk', sans-serif;
  color: var(--km-text);
  background: var(--km-bg);
  border-radius: var(--km-radius);
  padding: 24px;
}

/* ── Badges & Meta ── */
.km-badge {
  display: inline-block;
  background: var(--km-red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}

.km-meta-date,
.km-meta-duration {
  font-size: 13px;
  color: var(--km-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Hero Layout ── */
.km-hero__inner {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.km-hero__cover {
  flex: 0 0 180px;
  border-radius: var(--km-radius);
  overflow: hidden;
}

.km-hero__cover img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.km-hero__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.km-hero__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.km-hero__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
}

.km-hero__subtitle {
  font-size: 15px;
  color: var(--km-muted);
  font-style: italic;
}

/* ── Descriptions (short + expandable full) ── */
.km-desc { }

.km-desc__short {
  font-size: 13px;
  color: var(--km-muted);
  line-height: 1.55;
  overflow-wrap: break-word;
}

.km-desc__full {
  font-size: 13px;
  color: var(--km-muted);
  line-height: 1.6;
  overflow-wrap: break-word;
}
.km-desc__full p  { margin: 0 0 .5em; }
.km-desc__full p:last-child { margin-bottom: 0; }
.km-desc__full ul,
.km-desc__full ol { margin: .3em 0 .5em 1.1em; }
.km-desc__full li { margin-bottom: .2em; }
.km-desc__full strong { color: var(--km-text); font-weight: 600; }

/* Fallback for content that needs no toggle */
.km-desc__inner {
  font-size: 13px;
  color: var(--km-muted);
  line-height: 1.6;
  overflow-wrap: break-word;
}
.km-desc__inner p  { margin: 0 0 .5em; }
.km-desc__inner p:last-child { margin-bottom: 0; }

.km-desc__toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  background: none;
  border: none;
  color: var(--km-muted);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  letter-spacing: .02em;
  transition: color .15s;
}
.km-desc__toggle:hover { color: var(--km-text); }
.km-desc__toggle svg { flex-shrink: 0; transition: transform .2s; }
.km-desc__toggle.is-open svg { transform: rotate(180deg); }

.km-hero__desc .km-desc__short,
.km-hero__desc .km-desc__full,
.km-featured__desc .km-desc__short,
.km-featured__desc .km-desc__full { font-size: 14px; color: var(--km-text); opacity: .85; }

/* ── Grid Layout ── */
.km-grid { display: flex; flex-direction: column; gap: 0; }

.km-grid__wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.km-grid__wrap[style] {
  grid-template-columns: repeat(var(--km-cols), 1fr);
}

.km-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--km-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s, border-color .2s, background .2s;
  backdrop-filter: blur(4px);
}

.km-card:hover {
  transform: translateY(-3px);
  background: rgba(255,255,255,.07);
  border-color: rgba(232,19,43,.5);
}

.km-card__cover {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}

.km-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}

.km-card:hover .km-card__cover img { transform: scale(1.04); }

.km-card__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.4);
  opacity: 0;
  transition: opacity .2s;
}

.km-card:hover .km-card__play { opacity: 1; }

.km-card__body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.km-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.km-card__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.km-card__subtitle {
  font-size: 12px;
  color: var(--km-muted);
  font-style: italic;
}

.km-card__desc { flex: 1; }

.km-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--km-border);
}

/* ── List Layout ── */
.km-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.km-list-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--km-radius);
  backdrop-filter: blur(4px);
  transition: background .2s, border-color .2s;
}

.km-list-item:hover {
  background: rgba(255,255,255,.07);
  border-color: rgba(232,19,43,.4);
}

.km-list-item:last-child { margin-bottom: 0; }

.km-list-item__thumb {
  position: relative;
  flex: 0 0 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
}

.km-list-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.km-list-item__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.5);
  opacity: 0;
  transition: opacity .2s;
}

.km-list-item:hover .km-list-item__play { opacity: 1; }

.km-list-item__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.km-list-item__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.km-list-item__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.km-list-item__subtitle {
  font-size: 12px;
  color: var(--km-muted);
  font-style: italic;
}

.km-list-item__desc { }

.km-list-item__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

/* ── Player ── */
.km-player {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--km-bg3);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 4px;
}

.km-play-btn {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--km-red);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background .15s, transform .15s;
}

.km-play-btn:hover { background: #c0102a; transform: scale(1.08); }
.km-play-btn svg { width: 16px; height: 16px; }
.km-icon-play { margin-left: 2px; }
.km-play-btn.is-playing .km-icon-play { display: none; }
.km-play-btn.is-playing .km-icon-pause { display: block !important; }

.km-player__bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.km-player__progress {
  flex: 1;
  height: 4px;
  background: var(--km-border);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.km-player__fill {
  height: 100%;
  background: var(--km-red);
  border-radius: 2px;
  width: 0%;
  transition: width .1s linear;
}

.km-player__time,
.km-player__dur {
  font-size: 11px;
  color: var(--km-muted);
  white-space: nowrap;
}


/* ── Share ── */
.km-share,
.km-share-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.km-share-link {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--km-bg3);
  border: 1px solid var(--km-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--km-muted);
  text-decoration: none;
  transition: color .15s, border-color .15s;
}

.km-share-link:hover { color: var(--km-green); border-color: var(--km-green); }

/* ── Featured Layout ── */
.km-featured {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.km-featured__top {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--km-radius);
  padding: 20px;
  backdrop-filter: blur(4px);
}

.km-featured__cover {
  flex: 0 0 140px;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
}

.km-featured__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.km-featured__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.km-featured__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.km-featured__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.km-featured__subtitle {
  font-size: 13px;
  color: var(--km-muted);
  font-style: italic;
}

.km-featured__desc { }

.km-featured__player .km-player {
  background: var(--km-bg2);
  border: 1px solid var(--km-border);
  border-radius: var(--km-radius);
  padding: 12px 16px;
}

.km-featured__grid {
  margin-top: 4px;
}

/* Player inside cards — compact */
.km-card__player { margin-top: 4px; }

.km-card__player .km-player {
  background: var(--km-bg);
  border: 1px solid var(--km-border);
  padding: 8px 10px;
  margin-top: 0;
}

.km-card__player .km-play-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.km-card__player .km-play-btn svg { width: 12px; height: 12px; }

/* Player inside list items */
.km-list-item__player { margin-top: 6px; }
.km-list-item__player .km-player { padding: 8px 10px; margin-top: 0; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .km-podcast { padding: 14px; }

  /* Hero */
  .km-hero__inner { flex-direction: column; gap: 14px; }
  .km-hero__cover { flex: none; width: 100%; }
  .km-hero__cover img { height: 200px; }

  /* Grid: single column on mobile */
  .km-grid__wrap { grid-template-columns: 1fr; gap: 12px; }

  /* Featured */
  .km-featured__top { flex-direction: column; gap: 12px; padding: 14px; }
  .km-featured__cover { flex: none; width: 100%; height: 180px; }
  .km-featured__cover img { height: 100%; }

  /* List */
  .km-list-item { gap: 12px; padding: 12px 0; }
  .km-list-item__thumb { flex: 0 0 56px; height: 56px; }

  /* Player */
  .km-player { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .km-player__bar { min-width: 0; width: 100%; order: 3; flex: 1 0 100%; }
  .km-player__progress { flex: 1; }
}

@media (min-width: 601px) and (max-width: 900px) {
  .km-grid__wrap { grid-template-columns: 1fr 1fr; }
}

.km-podcast-error {
  color: var(--km-muted);
  font-size: 14px;
  padding: 20px;
  text-align: center;
}
