/* Meditation player — inline card + full-screen "now playing".
   Self-contained, all classes prefixed med- to avoid collisions.
   Note: the site sets html { font-size: 62.5% } (1rem = 10px), so we use px
   throughout to keep sizing predictable. We also reset padding/box-sizing on
   our buttons because the theme styles bare <button> elements. */

.med-player {
    --med-accent: #c75b39;
    --med-accent-soft: rgba(199, 91, 57, 0.12);
    margin: 20px 0;
}

.med-player *,
.med-fs * {
    box-sizing: border-box;
}

.med-player audio {
    display: none;
}

/* neutralise theme button styling inside the player */
.med-card button,
.med-fs button {
    padding: 0;
    margin: 0;
    border: none;
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.med-icon,
.med-skip__icon,
.med-fs__ring {
    flex: none;
}

/* ---------- inline card ---------- */

.med-card {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    padding: 12px 14px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 6px 22px rgba(40, 40, 60, 0.10);
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.med-card:hover,
.med-card:focus-visible {
    box-shadow: 0 10px 30px rgba(40, 40, 60, 0.16);
    transform: translateY(-1px);
    outline: none;
}

.med-card__thumb {
    flex: none;
    width: 96px;
    height: 96px;
    border-radius: 18px;
    background-color: var(--med-accent-soft);
    background-size: cover;
    background-position: center;
    position: relative;
}

.med-card__eq {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    padding-bottom: 12px;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 18px;
}

.med-card__eq i {
    width: 3px;
    height: 8px;
    background: #fff;
    border-radius: 2px;
    animation: med-eq 0.9s ease-in-out infinite;
}

.med-card__eq i:nth-child(2) { animation-delay: 0.25s; }
.med-card__eq i:nth-child(3) { animation-delay: 0.5s; }

@keyframes med-eq {
    0%, 100% { height: 6px; }
    50% { height: 18px; }
}

.med-card__meta {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.med-card__eyebrow {
    font-size: 11px;
    letter-spacing: 0.02em;
    color: var(--med-accent);
    font-weight: 700;
}

.med-card__title {
    display: block;
    position: relative;
    max-width: 100%;
    font-size: 17px;
    font-weight: 700;
    color: #2f3a3f;
    white-space: nowrap;
    overflow: hidden;
}

.med-card__title-inner {
    display: inline-block;
    white-space: nowrap;
}

/* When the title overflows on small screens: scroll it right-to-left, fading to
   white only at the edge where text is cut off. At rest the start is fully
   readable (right edge fades); while scrolled the end is readable (left fades).
   Toggled via JS overflow detection; --med-title-shift/-dur set inline. */
.med-card__title--scroll .med-card__title-inner {
    animation: med-title-marquee var(--med-title-dur, 10s) ease-in-out 1s infinite;
}

.med-card__title--scroll::before,
.med-card__title--scroll::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 22px;
    z-index: 2;
    pointer-events: none;
}

.med-card__title--scroll::before {
    left: 0;
    background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
    opacity: 0;
    animation: med-title-leftfade var(--med-title-dur, 10s) ease-in-out 1s infinite;
}

.med-card__title--scroll::after {
    right: 0;
    background: linear-gradient(to left, #fff, rgba(255, 255, 255, 0));
    opacity: 1;
    animation: med-title-rightfade var(--med-title-dur, 10s) ease-in-out 1s infinite;
}

@keyframes med-title-marquee {
    0%, 16% { transform: translateX(0); }
    50%, 66% { transform: translateX(var(--med-title-shift, 0)); }
    100% { transform: translateX(0); }
}

@keyframes med-title-leftfade {
    0%, 16% { opacity: 0; }
    50%, 66% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes med-title-rightfade {
    0%, 16% { opacity: 1; }
    50%, 66% { opacity: 0; }
    100% { opacity: 1; }
}

.med-card__time {
    font-size: 13.5px;
    color: #7c8a90;
}

.med-card__controls {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.med-card__restart {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #eaeef0;
    color: #586870;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.med-card__restart:hover { background: #dde4e7; transform: scale(1.06); }
.med-card__restart:focus { background: #dde4e7; }
.med-card__restart:active { background: #dde4e7; transform: scale(0.96); }

.med-card__restart-icon {
    width: 18px;
    height: 18px;
    display: block;
}

.med-card__play {
    flex: none;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--med-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(199, 91, 57, 0.4);
    transition: transform 0.15s ease;
}

.med-card__play:hover { transform: scale(1.06); }
.med-card__play:active { transform: scale(0.96); }

.med-card__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    width: 100%;
    background: rgba(0, 0, 0, 0.06);
}

.med-card__progress > div {
    height: 100%;
    background: var(--med-accent);
    transition: width 0.25s linear;
}

/* ---------- full-screen "now playing" ---------- */

body.med-fs-open {
    overflow: hidden;
}

.med-fs {
    position: fixed;
    inset: 0;
    z-index: 100000;
    color: #fff;
    overflow: hidden;
    animation: med-fade-in 0.25s ease;
}

@keyframes med-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.med-fs__bg {
    position: absolute;
    inset: -8%;
    background-color: #3a4a52;
    background-size: cover;
    background-position: center;
    filter: blur(18px) saturate(1.1);
    transform: scale(1.1);
}

.med-fs__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(20, 26, 30, 0.45) 0%, rgba(20, 26, 30, 0.55) 45%, rgba(20, 26, 30, 0.8) 100%);
}

.med-fs__close {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: 20px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.16) !important;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.med-fs__close svg {
    flex: none;
    width: 20px;
    height: 20px;
    stroke: #fff;
    stroke-width: 2.2;
    stroke-linecap: round;
    fill: none;
}

.med-fs__content {
    position: relative;
    height: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: max(32px, env(safe-area-inset-top)) 28px max(32px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
}

.med-fs__head {
    text-align: center;
    margin-top: 48px;
}

.med-fs__eyebrow {
    display: block;
    font-size: 14px;
    letter-spacing: 0.02em;
    opacity: 0.85;
    font-weight: 600;
    margin-bottom: 8px;
}

.med-fs__title {
    font-size: 30px;
    line-height: 1.15;
    font-weight: 800;
    margin: 0;
    color: #fff;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

.med-fs__stage {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.med-fs__bigplay {
    position: relative;
    width: 168px;
    height: 168px;
    box-shadow: none;
    background: transparent;
    cursor: pointer;
    color: #fff;
}

.med-fs__ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.med-fs__ring-track {
    fill: rgba(255, 255, 255, 0.16);
    stroke: rgba(255, 255, 255, 0.25);
    stroke-width: 4;
}

.med-fs__ring-progress {
    fill: none;
    stroke: #fff;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.25s linear;
}

.med-fs__bigplay-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.med-fs__bigplay:active { transform: scale(0.97); }

.med-icon { fill: currentColor; display: block; }
.med-icon--big { width: 64px; height: 64px; }
.med-icon--small { width: 24px; height: 24px; }
.med-fs__bigplay .med-icon--big { filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35)); }
/* nudge the play triangle to look optically centered */
.med-fs__bigplay-icon .med-icon path { transform: translateX(2px); }

.med-fs__skips {
    display: flex;
    align-items: center;
    gap: 56px;
}

.med-skip {
    position: relative;
    width: 44px;
    height: 44px;
    box-shadow: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
}

.med-skip:hover { opacity: 1; }
.med-skip:active { transform: scale(0.94); }

/* keep the transparent buttons transparent through theme hover/focus/active states */
.med-skip:hover, .med-skip:focus, .med-skip:active,
.med-fs__bigplay:hover, .med-fs__bigplay:focus, .med-fs__bigplay:active {
    background: transparent;
}

.med-fs button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 3px;
    border-radius: 10px;
}

.med-card button:focus-visible {
    outline: 2px solid var(--med-accent);
    outline-offset: 3px;
}

.med-skip__icon {
    width: 28px;
    height: 28px;
}

.med-fs__scrub {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

.med-fs__t {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
    min-width: 42px;
    text-align: center;
}

.med-fs__range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 1 auto;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #fff var(--med-progress, 0%), rgba(255, 255, 255, 0.25) var(--med-progress, 0%));
    cursor: pointer;
    outline: none;
}

.med-fs__range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.med-fs__range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.med-fs__range::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.25);
}

.med-fs__range::-moz-range-progress {
    height: 6px;
    border-radius: 3px;
    background: #fff;
}

.med-fs__error {
    font-size: 13px;
    opacity: 0.9;
    text-align: center;
    margin-top: 12px;
}

.med-fs__error a { color: #fff; text-decoration: underline; }

@media (max-width: 360px) {
    .med-fs__title { font-size: 25px; }
    .med-fs__bigplay { width: 144px; height: 144px; }
    .med-icon--big { width: 56px; height: 56px; }
    .med-fs__skips { gap: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    .med-fs, .med-card, .med-card__play, .med-fs__ring-progress, .med-card__progress > div, .med-card__eq i {
        animation: none !important;
        transition: none !important;
    }
}
