

:root {
  --player-accent: #212529;
  --player-accent-soft: rgba(33, 37, 41, 0.08);
  --player-border: #e0e3ec;
  --player-muted: #6b7280;
  --player-text: #111827;
}

/* ------------------------------------------------- artikelkort med bild */

.article-card-media {
  display: flex;
  align-items: flex-start;
  gap: 0.95rem;
}

.article-card-media .article-card-body {
  flex: 1 1 auto;
  min-width: 0;
}

/* Bilden fyller hela kortets höjd */
.article-thumb {
  flex: 0 0 auto;
  align-self: stretch;
  display: block;
  width: 130px;
  height: auto;
  min-height: 112px;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: #f3f4f6;
  text-decoration: none;
}

.article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.article-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  border: 1px solid var(--player-border);
}

.article-thumb-empty span {
  font-size: 1.6rem;
  font-weight: 700;
  color: #b8bdc9;
  line-height: 1;
}

.article-card-audio {
  flex: 0 0 auto;
  align-self: center;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.article-card-media.ap-no-audio .article-card-audio,
.ap-inline.ap-no-audio {
  display: none;
}

body.soft-nav-loading {
  cursor: progress;
}

/* Längden hänger under play-knappen */
.article-card-audio-play {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.article-card-audio .ap-icon-btn-queue {
  margin-top: 3px;
}

.article-card-audio .ap-icon-btn-play {
  width: 44px;
  height: 44px;
}

.article-card-audio .ap-icon-btn-play svg {
  width: 20px;
  height: 20px;
}

.article-card-audio .ap-duration {
  font-size: 0.78rem;
  color: var(--player-muted);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------- knappar */

.ap-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--player-border);
  background-color: #ffffff;
  color: var(--player-text);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

.ap-icon-btn:hover {
  background-color: #f3f4f6;
}

.ap-icon-btn:active {
  transform: scale(0.96);
}

.ap-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.ap-icon-btn-play {
  background-color: var(--player-accent);
  border-color: var(--player-accent);
  color: #ffffff;
}

.ap-icon-btn-play:hover {
  background-color: var(--player-accent);
  border-color: var(--player-accent);
  filter: brightness(1.12);
}

.ap-icon-btn-queue.is-queued {
  border-color: var(--player-accent);
  color: var(--player-accent);
  background-color: var(--player-accent-soft);
}

.ap-text-btn {
  border: 1px solid transparent;
  background: none;
  color: var(--player-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.ap-text-btn:hover {
  background-color: #f3f4f6;
  color: var(--player-text);
}

.ap-lang {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--player-border);
  border-radius: 0.4rem;
  overflow: hidden;
}

.ap-lang button {
  border: none;
  background: none;
  padding: 0.15rem 0.48rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--player-muted);
  cursor: pointer;
  line-height: 1.2;
}

.ap-lang button + button {
  border-left: 1px solid var(--player-border);
}

.ap-lang button:hover:not(:disabled) {
  background-color: #f3f4f6;
  color: var(--player-text);
}

.ap-lang button.is-active {
  background-color: var(--player-accent);
  color: #ffffff;
}

.ap-lang button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ------------------------------------------------------------ progress */

.ap-progress {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  min-width: 60px;
  border-radius: 999px;
  background-color: #e5e7eb;
  cursor: pointer;
  outline: none;
}

.ap-progress:focus-visible {
  box-shadow: 0 0 0 3px var(--player-accent-soft);
}

.ap-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background-color: var(--player-accent);
}

.ap-progress-handle {
  position: absolute;
  top: 50%;
  left: 0;
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  border-radius: 999px;
  background-color: var(--player-accent);
  transform: translateY(-50%);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.3);
}

.ap-time {
  font-size: 0.8rem;
  color: var(--player-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------- inline-spelare i artikeln */

.ap-inline {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 1.1rem;
  border: 1px solid var(--player-border);
  border-radius: 0.6rem;
  background-color: #f9fafb;
}

.ap-inline-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background-color: var(--player-accent);
  color: #ffffff;
  cursor: pointer;
}

.ap-inline-play svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.ap-inline-label {
  font-size: 0.88rem;
  color: var(--player-text);
  white-space: nowrap;
}

.ap-inline .ap-progress {
  max-width: 220px;
}

.ap-inline-divider {
  width: 1px;
  height: 22px;
  background-color: var(--player-border);
}

.ap-inline-queue {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--player-border);
  border-radius: 999px;
  background-color: #ffffff;
  color: var(--player-text);
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}

.ap-inline-queue:hover {
  background-color: #f3f4f6;
}

.ap-inline-queue.is-queued {
  border-color: var(--player-accent);
  color: var(--player-accent);
  background-color: var(--player-accent-soft);
}

.ap-inline .ap-icon-btn {
  width: 32px;
  height: 32px;
  border-color: transparent;
  background: none;
  color: var(--player-muted);
}

.ap-inline .ap-icon-btn svg {
  width: 17px;
  height: 17px;
}

/* --------------------------------------------------- sticky bottenbar */

.ap-root {
  display: none;
  /* Spelaren följer layoutens bredd (1100px) med en aning marginal utanför */
  --ap-shell-width: min(1140px, calc(100vw - 2rem));
}

body.ap-active .ap-root {
  display: block;
}

/* --ap-bar-height mäts av js/audio-player.js så baren aldrig täcker innehåll */
body.ap-active {
  padding-bottom: calc(var(--ap-bar-height, 76px) + 24px);
}

.ap-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: var(--ap-shell-width);
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background-color: #ffffff;
  border: 1px solid var(--player-border);
  border-bottom: none;
  border-radius: 0.7rem 0.7rem 0 0;
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.12);
}

.ap-bar-track {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 1 230px;
  min-width: 0;
}

.ap-bar-thumb {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 0.4rem;
  overflow: hidden;
  background-color: #f3f4f6;
}

.ap-bar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ap-bar-meta {
  min-width: 0;
}

.ap-bar-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--player-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-bar-sub {
  font-size: 0.75rem;
  color: var(--player-muted);
}

.ap-bar-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.ap-main-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background-color: var(--player-accent);
  color: #ffffff;
  cursor: pointer;
}

.ap-main-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.ap-bar .ap-skip {
  border-color: transparent;
  background: none;
  color: var(--player-muted);
}

.ap-bar .ap-skip svg {
  width: 21px;
  height: 21px;
}

.ap-bar-progress {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1 1 auto;
  min-width: 0;
}

.ap-bar-extras {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.ap-volume-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ap-volume-slider {
  width: 74px;
  accent-color: var(--player-accent);
}

.ap-bar-extras .ap-icon-btn {
  border-color: transparent;
  background: none;
  color: var(--player-muted);
}

.ap-bar-extras .ap-icon-btn:hover {
  color: var(--player-text);
  background-color: #f3f4f6;
}

.ap-bar-extras .ap-close:hover {
  color: #b91c1c;
  background-color: rgba(185, 28, 28, 0.08);
}

.ap-close svg {
  width: 15px;
  height: 15px;
}

/* ------------------------------------------------------------ köpanel */

.ap-queue-panel {
  position: fixed;
  left: 50%;
  bottom: calc(var(--ap-bar-height, 76px) + 10px);
  /* Högerkant i linje med spelarens (och layoutens) högerkant */
  transform: translateX(calc(var(--ap-shell-width) / 2 - 100% - 0.5rem));
  z-index: 1031;
  width: 320px;
  max-width: calc(100vw - 2rem);
  display: none;
  background-color: #ffffff;
  border: 1px solid var(--player-border);
  border-radius: 0.6rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.ap-root.is-queue-open .ap-queue-panel {
  display: block;
}

.ap-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--player-border);
}

.ap-queue-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--player-text);
}

.ap-queue-clear {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.8rem;
  color: var(--player-accent);
  cursor: pointer;
}

.ap-queue-clear:hover {
  text-decoration: underline;
}

.ap-queue-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  max-height: 40vh;
  overflow-y: auto;
}

.ap-queue-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 0.4rem;
}

.ap-queue-item:hover {
  background-color: #f9fafb;
}

.ap-queue-item.is-current {
  background-color: var(--player-accent-soft);
}

.ap-queue-item-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: none;
  padding: 0.45rem 0.35rem;
  text-align: left;
  cursor: pointer;
}

.ap-queue-index {
  flex: 0 0 auto;
  width: 18px;
  font-size: 0.78rem;
  color: var(--player-muted);
  text-align: center;
}

.ap-queue-index svg {
  width: 15px;
  height: 15px;
  fill: var(--player-accent);
}

.ap-queue-item-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.83rem;
  color: var(--player-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-queue-item-time {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--player-muted);
  font-variant-numeric: tabular-nums;
}

.ap-queue-remove {
  flex: 0 0 auto;
  border: none;
  background: none;
  padding: 0.3rem;
  color: var(--player-muted);
  cursor: pointer;
  line-height: 0;
}

.ap-queue-remove:hover {
  color: #b91c1c;
}

.ap-queue-remove svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Equalizer-animation på spåret som spelas */
.ap-queue-item.is-current .ap-bars rect {
  animation: ap-eq 0.9s ease-in-out infinite;
  transform-origin: bottom;
}

.ap-queue-item.is-current .ap-bars rect:nth-child(2) { animation-delay: 0.15s; }
.ap-queue-item.is-current .ap-bars rect:nth-child(3) { animation-delay: 0.3s; }
.ap-queue-item.is-current .ap-bars rect:nth-child(4) { animation-delay: 0.45s; }

@keyframes ap-eq {
  0%, 100% { transform: scaleY(0.5); }
  50%      { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .ap-queue-item.is-current .ap-bars rect {
    animation: none;
  }
}

/* --------------------------------------------------------- responsivt */

@media (max-width: 991.98px) {
  .ap-bar-extras .ap-volume-wrap {
    display: none;
  }

  .ap-inline {
    flex-wrap: wrap;
  }

  .ap-inline .ap-progress {
    max-width: none;
  }
}

@media (max-width: 767.98px) {
  /* Full bredd i mobilläget, precis som layouten */
  .ap-root {
    --ap-shell-width: 100vw;
  }

  .ap-bar {
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .ap-bar .ap-skip,
  .ap-bar-extras .ap-text-btn {
    display: none;
  }

  .ap-bar {
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }

  /* Liten flex-basis så titelraden inte tvingar ner kontrollerna på egen rad */
  .ap-bar-track {
    flex: 1 1 110px;
  }

  .ap-bar-progress {
    order: 3;
    flex: 1 0 100%;
  }

  .article-thumb {
    width: 112px;
    min-height: 96px;
  }
}

/* Mobil: bild och rubrik överst, brödtext under, kategori/datum längst ner
   intill lästiden – annars blir korten för höga */
@media (max-width: 575.98px) {
  .article-card-media {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb    title  title"
      "excerpt  excerpt excerpt"
      "readtime meta   meta"
      "audio    audio  audio";
    column-gap: 0.75rem;
    row-gap: 0.1rem;
  }

  .article-card-media .article-card-body {
    display: contents;
  }

  .article-card-media .article-thumb {
    grid-area: thumb;
    align-self: start;
    width: 104px;
    height: 80px;
    min-height: 0;
  }

  .article-card-media .article-title {
    grid-area: title;
    align-self: start;
    margin-bottom: 0;
  }

  .article-card-media .article-excerpt {
    grid-area: excerpt;
    margin-top: 0.55rem;
    margin-bottom: 0.75rem;
  }

  /* Fotrad: lästid till vänster, kategori och datum till höger, samma stil */
  .article-card-media .article-meta,
  .article-card-media .article-meta-secondary {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.4;
    color: #9ca3af;
    margin-bottom: 0;
  }

  .article-card-media .article-meta {
    grid-area: meta;
    text-align: right;
  }

  .article-card-media .article-meta-secondary {
    grid-area: readtime;
    align-self: start;
    white-space: nowrap;
  }

  .article-card-audio {
    grid-area: audio;
    flex-direction: row;
    align-self: stretch;
    justify-content: flex-start;
    gap: 0.7rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--player-border);
  }
}

/* ------------------------------------------- senaste artiklar i sidopanelen */

.sidebar-articles {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.sidebar-article {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
}

.sidebar-article:hover .sidebar-article-title {
  color: var(--player-accent, #111827);
}

.sidebar-article-thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 0.45rem;
  overflow: hidden;
  background-color: #f3f4f6;
}

.sidebar-article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-article-thumb.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: #b8bdc9;
}

.sidebar-article-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-top: 0.05rem;
}

.sidebar-article-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar-article-meta {
  font-size: 0.75rem;
  color: #6b7280;
}

.sidebar-articles-more {
  display: inline-block;
  margin-top: 0.85rem;
  font-size: 0.8rem;
  color: #6b7280;
  text-decoration: none;
}

.sidebar-articles-more:hover {
  color: #111827;
}
