/* Player de áudio do Instituto Somata.
   Escopo fechado em .somata-player e .somata-mini para não conflitar
   com o CSS do portal. */

.somata-player {
  --sp-navy: #0b1830;
  --sp-text: #ffffff;
  --sp-muted: #b7c5e4;
  --sp-line: rgba(255, 255, 255, 0.12);
  --sp-panel: rgba(255, 255, 255, 0.07);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: 0 0 30px;
  padding: 22px 24px 16px;
  border-radius: 20px;
  background: var(--sp-navy);
  color: var(--sp-text);
  box-shadow: 0 22px 60px rgba(16, 33, 63, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-family: inherit;
}

.somata-player *,
.somata-mini * {
  box-sizing: border-box;
}

.somata-player .sp-bg {
  position: absolute;
  inset: -25%;
  z-index: 0;
  background-image: var(--sp-cover, none);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(46px) saturate(1.15);
  opacity: 0.55;
  transform: scale(1.2);
  pointer-events: none;
}

.somata-player::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(151, 124, 214, 0.38), transparent 55%),
    linear-gradient(115deg, rgba(9, 20, 40, 0.97) 0%, rgba(12, 27, 54, 0.93) 55%, rgba(31, 62, 118, 0.78) 100%);
  pointer-events: none;
}

.somata-player > * {
  position: relative;
  z-index: 2;
}

.somata-player .sp-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.somata-player .sp-cover {
  width: 66px;
  height: 66px;
  flex: 0 0 66px;
  border-radius: 16px;
  background: linear-gradient(145deg, #c3b2ef 0%, #9aa9ea 45%, #5f7fc9 100%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #fff;
  user-select: none;
}

.somata-player .sp-cover-num {
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.somata-player .sp-cover-label {
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}

.somata-player .sp-meta {
  min-width: 0;
}

.somata-player .sp-eyebrow {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: #a8c2ff;
}

.somata-player .sp-title {
  margin: 0 0 2px;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
}

.somata-player .sp-sub {
  margin: 0;
  font-size: 13px;
  color: var(--sp-muted);
}

.somata-player .sp-dot {
  margin: 0 4px;
  opacity: 0.45;
}

.somata-player .sp-badge {
  margin-left: auto;
  align-self: flex-start;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #dbe5ff;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.somata-player .sp-main {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
}

.somata-player .sp-play {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #10213f;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22), 0 0 0 7px rgba(255, 255, 255, 0.05);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.somata-player .sp-play:hover {
  transform: scale(1.05);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35), 0 0 0 8px rgba(255, 255, 255, 0.08);
}

.somata-player .sp-play:active {
  transform: scale(0.98);
}

.somata-player .sp-play:focus-visible,
.somata-player .sp-icon:focus-visible,
.somata-player .sp-chip:focus-visible {
  outline: 2px solid #a8c2ff;
  outline-offset: 3px;
}

.somata-player .sp-play svg {
  width: 22px;
  height: 22px;
  display: block;
}

.somata-player .sp-center {
  flex: 1;
  min-width: 0;
}

.somata-player .sp-wave-wrap {
  position: relative;
  height: 64px;
  cursor: pointer;
  touch-action: none;
  outline: none;
  border-radius: 8px;
}

.somata-player .sp-wave-wrap:focus-visible {
  box-shadow: 0 0 0 2px rgba(168, 194, 255, 0.65);
}

.somata-player .sp-wave {
  width: 100%;
  height: 64px;
  display: block;
}

.somata-player .sp-times {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
  font-size: 11px;
  color: var(--sp-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.somata-player .sp-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: #071226;
  color: #fff;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.somata-player .sp-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--sp-line);
}

.somata-player .sp-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.somata-player .sp-group.sp-right {
  margin-left: auto;
}

.somata-player .sp-icon,
.somata-player .sp-chip {
  border: 1px solid var(--sp-line);
  background: var(--sp-panel);
  color: #eaf0ff;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.somata-player .sp-icon {
  height: 32px;
  min-width: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.somata-player .sp-chip {
  height: 32px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
}

.somata-player .sp-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.somata-player .sp-text svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.somata-player .sp-icon:hover,
.somata-player .sp-chip:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.22);
}

.somata-player .sp-icon:active,
.somata-player .sp-chip:active {
  transform: scale(0.97);
}

.somata-player .sp-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 4px;
}

.somata-player .sp-volume .sp-icon {
  padding: 0 8px;
}

.somata-player .sp-vol {
  width: 68px;
  height: 4px;
  accent-color: #b9c9ff;
  cursor: pointer;
}

.somata-player .sp-hint {
  font-size: 10px;
  color: #8194b7;
  white-space: nowrap;
}

.somata-player.is-playing .sp-cover {
  animation: sp-breathe 3.2s ease-in-out infinite;
}

@keyframes sp-breathe {
  0%, 100% { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
  50% { box-shadow: 0 10px 30px rgba(168, 194, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
}

.somata-mini {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 28px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(10, 22, 44, 0.94);
  color: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
  z-index: 9999;
  overflow: hidden;
}

.somata-mini[hidden] {
  display: none;
}

.somata-mini .sm-progress {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
}

.somata-mini .sm-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #8fb6ff, #d6c4ff);
  transition: width 0.15s linear;
}

.somata-mini .sm-cover {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  margin-top: 2px;
  border-radius: 10px;
  background: linear-gradient(145deg, #c3b2ef, #5f7fc9);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}

.somata-mini .sm-meta {
  flex: 1;
  min-width: 0;
  margin-top: 2px;
  cursor: pointer;
}

.somata-mini .sm-meta strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.somata-mini .sm-meta small {
  display: block;
  margin-top: 1px;
  font-size: 10px;
  color: #aebfe0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.somata-mini .sm-time {
  margin-top: 2px;
  font-size: 10px;
  color: #aebfe0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.somata-mini .sm-play,
.somata-mini .sm-close {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  margin-top: 2px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.somata-mini .sm-play {
  background: #fff;
  color: #10213f;
  border-color: #fff;
}

.somata-mini .sm-play svg {
  width: 15px;
  height: 15px;
}

.somata-mini .sm-close {
  flex-basis: 28px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #aebfe0;
  font-size: 18px;
  line-height: 1;
  opacity: 0.75;
}

.somata-mini .sm-close:hover {
  opacity: 1;
}

.somata-audio-missing {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 28px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: #0b1830;
  color: #fff;
  box-shadow: 0 16px 40px rgba(16, 33, 63, 0.16);
}

.somata-audio-missing .sam-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #ffd2a8;
  font-weight: 700;
}

.somata-audio-missing strong {
  display: block;
  font-size: 14px;
  line-height: 1.3;
}

.somata-audio-missing span {
  display: block;
  margin-top: 2px;
  color: #b7c5e4;
  font-size: 12px;
}

.somata-toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(8px);
  max-width: calc(100% - 32px);
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: #0b1830;
  color: #fff;
  font-size: 12px;
  text-align: center;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.somata-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 720px) {
  .somata-player {
    padding: 18px 16px 14px;
    border-radius: 16px;
    margin-bottom: 24px;
  }

  .somata-player .sp-cover {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
    border-radius: 13px;
  }

  .somata-player .sp-cover-num {
    font-size: 20px;
  }

  .somata-player .sp-title {
    font-size: 17px;
  }

  .somata-player .sp-sub {
    font-size: 12px;
  }

  .somata-player .sp-badge {
    display: none;
  }

  .somata-player .sp-main {
    gap: 12px;
    margin-top: 16px;
  }

  .somata-player .sp-play {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }

  .somata-player .sp-play svg {
    width: 19px;
    height: 19px;
  }

  .somata-player .sp-wave-wrap,
  .somata-player .sp-wave {
    height: 52px;
  }

  .somata-player .sp-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .somata-player .sp-hint {
    display: none;
  }

  .somata-player .sp-group.sp-right {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .somata-player .sp-volume {
    display: none;
  }

  .somata-mini {
    bottom: 10px;
    width: calc(100% - 20px);
    gap: 9px;
    padding: 9px 9px 9px 8px;
  }

  .somata-mini .sm-time {
    display: none;
  }

  .somata-mini .sm-cover {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }
}
