/* WMR Stories Widget */
.wmr-stories-section {
    --wmr-ring-1: #f59e0b;
    --wmr-ring-2: #ef4444;
    --wmr-ring-3: #a855f7;
    --wmr-ring-w: 3px;
    --wmr-overlay: rgba(0, 0, 0, 0.7);
    --wmr-modal-bg: rgba(0, 0, 0, 0.95);
    --wmr-progress: #ffffff;
    width: 100%;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.4;
}
/* Isolar do tema: resets escopados para o widget */
.wmr-stories-section *,
.wmr-stories-section *::before,
.wmr-stories-section *::after { box-sizing: border-box; }
.wmr-stories-section p,
.wmr-modal p { margin: 0; padding: 0; }
.wmr-stories-section img,
.wmr-stories-section video,
.wmr-modal img,
.wmr-modal video { max-width: none; border: 0; vertical-align: top; }
.wmr-stories-section button { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; line-height: inherit; }
.wmr-stories-section a { text-decoration: none; }
/* Modal vive fora do .wmr-stories-section também — escopar resets nele */
.wmr-modal { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; line-height: 1.4; box-sizing: border-box; }
.wmr-modal *, .wmr-modal *::before, .wmr-modal *::after { box-sizing: border-box; }
.wmr-modal button { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; }
.wmr-stories-wrap { margin: 0 auto; width: 100%; }

.wmr-stories-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.wmr-stories-grid.wmr-layout-inline {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.wmr-stories-grid.wmr-layout-inline::-webkit-scrollbar { display: none; }
.wmr-stories-grid.wmr-layout-inline .wmr-story-btn { flex: 0 0 60%; max-width: 240px; }
.wmr-stories-grid.wmr-layout-masonry { grid-auto-rows: 10px; grid-auto-flow: dense; }

.wmr-story-btn {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    color: inherit;
    font: inherit;
}
.wmr-story-btn:focus { outline: 2px solid var(--wmr-ring-2); outline-offset: 2px; }

.wmr-story-ring {
    position: relative;
    padding: var(--wmr-ring-w);
    border-radius: 18px;
    background: linear-gradient(135deg, var(--wmr-ring-1), var(--wmr-ring-2), var(--wmr-ring-3));
    transition: transform 0.2s ease;
}
.wmr-stories-section[data-hover="1"] .wmr-story-btn:hover .wmr-story-ring { transform: scale(1.02); }
.wmr-story-btn:active .wmr-story-ring { transform: scale(0.97); }
.wmr-stories-section[data-ring="0"] .wmr-story-ring {
    padding: 0;
    background: transparent;
}

.wmr-story-card {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 18px;
    overflow: hidden;
    background: #1a1a1a;
}
.wmr-story-card video,
.wmr-story-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wmr-story-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 12px;
    background: linear-gradient(to top, var(--wmr-overlay), transparent 60%);
    color: #fff;
    gap: 10px;
}
.wmr-story-play {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.wmr-story-play svg { width: 14px; height: 14px; fill: #fff; }
.wmr-story-title { font-size: 14px; font-weight: 600; line-height: 1.2; margin: 0; }
.wmr-story-category { font-size: 11px; opacity: 0.85; margin: 0; }

/* ===== Modal ===== */
.wmr-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--wmr-modal-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.wmr-modal[hidden] { display: none; }
.wmr-modal-stage {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
}
@media (min-width: 768px) {
    .wmr-modal-stage { width: 420px; height: 90vh; border-radius: 18px; }
}
.wmr-modal-media-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.wmr-modal-media-wrap video,
.wmr-modal-media-wrap img,
.wmr-modal-stage video,
.wmr-modal-stage > img.wmr-modal-media {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

.wmr-modal-close, .wmr-modal-arrow {
    position: absolute;
    background: transparent;
    border: 0;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    padding: 8px;
    z-index: 10;
}
.wmr-modal-close { top: 16px; right: 16px; }
.wmr-modal-arrow { top: 50%; transform: translateY(-50%); display: none; }
.wmr-modal-arrow svg, .wmr-modal-close svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 2; }
.wmr-modal-arrow.wmr-prev { left: 16px; }
.wmr-modal-arrow.wmr-next { right: 16px; }
.wmr-modal-arrow:disabled { opacity: 0.3; cursor: default; }
@media (min-width: 768px) {
    .wmr-modal[data-arrows="1"] .wmr-modal-arrow { display: flex; }
}

.wmr-progress-bars {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    gap: 4px;
    padding: 12px;
    z-index: 5;
}
.wmr-progress-bar {
    flex: 1;
    height: 2px;
    background: rgba(255,255,255,0.3);
    border-radius: 999px;
    overflow: hidden;
}
.wmr-progress-bar > span {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--wmr-progress);
    transition: width 0.1s linear;
}

.wmr-modal-header {
    position: absolute;
    top: 28px; left: 12px; right: 12px;
    display: flex; align-items: center; gap: 10px;
    z-index: 5; color: #fff;
    margin-top: 12px;
}
.wmr-modal-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    overflow: hidden; flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.85);
}
.wmr-modal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wmr-modal-title { font-size: 14px; font-weight: 600; margin: 0; }
.wmr-modal-cat { font-size: 12px; opacity: 0.7; margin: 0; }

.wmr-modal-caption {
    position: absolute;
    top: 70px; left: 0; right: 0;
    padding: 8px 16px 18px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
    color: #fff;
    z-index: 5;
    pointer-events: none;
}
.wmr-modal-caption p {
    font-size: 14px;
    line-height: 1.35;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    font-weight: 500;
}

.wmr-modal-tap {
    position: absolute;
    inset: 0;
    display: flex;
    z-index: 6;
}
.wmr-modal-tap > div { flex: 1; height: 100%; }
@media (min-width: 768px) { .wmr-modal-tap { display: none; } }

body.wmr-modal-open { overflow: hidden; }
