/* N-JOY Audio Player — embedded in articles.
   Light card that sits on article surfaces, with N-JOY orange accents.
   Usage: <div class="njp-aplayer" data-njp-player data-src="..." data-title="..."></div>
*/

.njp-aplayer-wrap {
    clear: both;
    float: left;
    width: 100%;
    margin: 24px 0 8px;
}
.njp-aplayer-wrap + .njp-aplayer-wrap { margin-top: 14px; }

.njp-aplayer {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 22px 18px 18px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 0% 0%, rgba(232, 78, 15, 0.05), transparent 55%),
        linear-gradient(180deg, #ffffff 0%, #f6f5f8 100%);
    border: 1px solid rgba(20, 19, 33, 0.08);
    box-shadow: 0 1px 2px rgba(20, 19, 33, 0.04), 0 10px 30px rgba(20, 19, 33, 0.05);
    color: #1d1929;
    transition: border-color .2s ease, box-shadow .25s ease;
    overflow: hidden;
    font-family: "Inter", "Lato", "Helvetica Neue", Arial, sans-serif;
}
.njp-aplayer::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 4px;
    background: linear-gradient(180deg, #E84E0F 0%, #EF7D00 100%);
    opacity: 0.85;
    transition: opacity .25s ease, width .25s ease;
}
.njp-aplayer.is-playing { border-color: rgba(232, 78, 15, 0.25); box-shadow: 0 2px 4px rgba(232, 78, 15, 0.08), 0 16px 38px rgba(232, 78, 15, 0.1); }
.njp-aplayer.is-playing::before { opacity: 1; width: 5px; }

/* watermark: N-JOY mark bottom-right */
.njp-aplayer-brand {
    position: absolute;
    right: 14px;
    bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(20, 19, 33, 0.22);
    pointer-events: none;
    user-select: none;
}
.njp-aplayer-brand-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #E84E0F;
    box-shadow: 0 0 0 2px rgba(232, 78, 15, 0.15);
    display: inline-block;
}
.njp-aplayer.is-playing .njp-aplayer-brand-dot {
    animation: njpApDot 1.6s ease-in-out infinite;
}
@keyframes njpApDot {
    0%, 100% { transform: scale(1);   box-shadow: 0 0 0 2px rgba(232, 78, 15, 0.15); }
    50%      { transform: scale(1.3); box-shadow: 0 0 0 5px rgba(232, 78, 15, 0);    }
}

/* play / pause */
.njp-aplayer-toggle {
    position: relative;
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 0;
    background: #E84E0F;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(232, 78, 15, 0.32);
    transition: transform .18s ease, box-shadow .25s ease, background .2s ease;
    outline: none;
    margin-left: 6px;
}
.njp-aplayer-toggle:hover { background: #EF7D00; transform: scale(1.07); box-shadow: 0 6px 22px rgba(232, 78, 15, 0.48); }
.njp-aplayer-toggle:active { transform: scale(0.94); }
.njp-aplayer-toggle:focus-visible { box-shadow: 0 0 0 3px rgba(232, 78, 15, 0.3), 0 4px 16px rgba(232, 78, 15, 0.32); }
.njp-aplayer-toggle svg { width: 20px; height: 20px; fill: currentColor; display: block; }
.njp-aplayer-toggle .njp-ap-pause,
.njp-aplayer-toggle .njp-ap-loader { display: none; }
.njp-aplayer.is-playing .njp-aplayer-toggle .njp-ap-play { display: none; }
.njp-aplayer.is-playing .njp-aplayer-toggle .njp-ap-pause { display: block; }
.njp-aplayer.is-loading .njp-aplayer-toggle .njp-ap-play,
.njp-aplayer.is-loading .njp-aplayer-toggle .njp-ap-pause { display: none; }
.njp-aplayer.is-loading .njp-aplayer-toggle .njp-ap-loader {
    display: block;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: njpApSpin 0.8s linear infinite;
}
@keyframes njpApSpin { to { transform: rotate(360deg); } }

.njp-aplayer-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 52px; /* room for brand watermark */
}

.njp-aplayer-top {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.njp-aplayer-title-wrap {
    flex: 1 1 auto;
    min-width: 0;
}
.njp-aplayer-subtitle {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: #E84E0F;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    margin-bottom: 2px;
}
.njp-aplayer-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #1d1929;
    line-height: 1.2;
}

/* equalizer bars — brand orange, not green */
.njp-aplayer-bars {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
    opacity: 0.35;
    transition: opacity .25s ease;
}
.njp-aplayer.is-playing .njp-aplayer-bars { opacity: 1; }
.njp-aplayer-bars span {
    display: inline-block;
    width: 3px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, #EF7D00, #E84E0F);
    transform-origin: bottom;
    transition: height .2s ease;
}
.njp-aplayer.is-playing .njp-aplayer-bars span:nth-child(1) { animation: njpApBar1 0.85s ease-in-out infinite; }
.njp-aplayer.is-playing .njp-aplayer-bars span:nth-child(2) { animation: njpApBar2 0.65s ease-in-out infinite 0.10s; }
.njp-aplayer.is-playing .njp-aplayer-bars span:nth-child(3) { animation: njpApBar3 0.75s ease-in-out infinite 0.20s; }
.njp-aplayer.is-playing .njp-aplayer-bars span:nth-child(4) { animation: njpApBar4 0.90s ease-in-out infinite 0.05s; }
.njp-aplayer.is-playing .njp-aplayer-bars span:nth-child(5) { animation: njpApBar5 0.80s ease-in-out infinite 0.15s; }
@keyframes njpApBar1 { 0%, 100% { height: 4px;  } 50% { height: 16px; } }
@keyframes njpApBar2 { 0%, 100% { height: 6px;  } 50% { height: 10px; } }
@keyframes njpApBar3 { 0%, 100% { height: 3px;  } 50% { height: 18px; } }
@keyframes njpApBar4 { 0%, 100% { height: 5px;  } 50% { height: 12px; } }
@keyframes njpApBar5 { 0%, 100% { height: 4px;  } 50% { height: 15px; } }

.njp-aplayer-bottom {
    display: flex;
    align-items: center;
    gap: 12px;
    font-variant-numeric: tabular-nums;
}

.njp-aplayer-time {
    font-size: 12px;
    color: rgba(20, 19, 33, 0.55);
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.njp-aplayer-time.njp-aplayer-current { text-align: right; color: #1d1929; }
.njp-aplayer-time.njp-aplayer-total   { text-align: left; }

.njp-aplayer-progress {
    flex: 1 1 auto;
    position: relative;
    height: 5px;
    background: rgba(20, 19, 33, 0.08);
    border-radius: 10px;
    cursor: pointer;
    overflow: visible;
    transition: height .15s ease;
}
.njp-aplayer-progress:hover { height: 7px; }
.njp-aplayer-progress-buffered,
.njp-aplayer-progress-played {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 10px;
    pointer-events: none;
}
.njp-aplayer-progress-buffered {
    width: 0%;
    background: rgba(20, 19, 33, 0.14);
    transition: width .3s ease;
}
.njp-aplayer-progress-played {
    width: 0%;
    background: linear-gradient(90deg, #E84E0F, #EF7D00);
    box-shadow: 0 0 8px rgba(232, 78, 15, 0.35);
    transition: width .12s linear;
}
.njp-aplayer-progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #E84E0F;
    box-shadow: 0 2px 6px rgba(232, 78, 15, 0.35);
    transform: translate(-50%, -50%) scale(0);
    transition: transform .15s ease, left .12s linear;
    pointer-events: none;
}
.njp-aplayer-progress:hover .njp-aplayer-progress-thumb,
.njp-aplayer.is-seeking .njp-aplayer-progress-thumb { transform: translate(-50%, -50%) scale(1); }

.njp-aplayer-volume {
    position: relative;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: rgba(20, 19, 33, 0.45);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
    outline: none;
}
.njp-aplayer-volume:hover { background: rgba(20, 19, 33, 0.05); color: #1d1929; }
.njp-aplayer-volume:focus-visible { box-shadow: 0 0 0 2px rgba(232, 78, 15, 0.3); }
.njp-aplayer-volume svg { width: 16px; height: 16px; fill: currentColor; display: block; }
.njp-aplayer-volume .njp-ap-muted { display: none; }
.njp-aplayer.is-muted .njp-aplayer-volume .njp-ap-unmuted { display: none; }
.njp-aplayer.is-muted .njp-aplayer-volume .njp-ap-muted   { display: block; }

/* responsive stacking */
@media (max-width: 640px) {
    .njp-aplayer {
        flex-wrap: wrap;
        gap: 14px;
        padding: 16px 18px 22px 16px;
    }
    .njp-aplayer-toggle { width: 48px; height: 48px; margin-left: 2px; }
    .njp-aplayer-toggle svg { width: 18px; height: 18px; }
    .njp-aplayer-body { flex: 1 1 calc(100% - 62px); padding-right: 0; }
    .njp-aplayer-volume { order: 3; margin-left: auto; }
    .njp-aplayer-brand { right: 14px; bottom: 6px; }
    .njp-aplayer-time { font-size: 11px; min-width: 36px; }
    .njp-aplayer-title { font-size: 13px; }
    .njp-aplayer-subtitle { font-size: 9px; letter-spacing: 1.2px; }
}

@media (max-width: 420px) {
    .njp-aplayer-volume { display: none; }
}
