/**
 * Full-screen Web Story viewer (app/Views/Pages/webstory-viewer.php).
 * Standalone page — does NOT use site.css's header/nav/footer/container
 * classes, this is its own self-contained template.
 */

:root {
    --brand-red:  #e63946;
    --brand-navy: #1d3557;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: #000;
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
}

.webstory-backdrop {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(30px) brightness(.5);
    transform: scale(1.15); /* hides the blurred edge */
    z-index: 0;
}

.webstory-frame {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    margin: 0 auto;
    background: #000;
    overflow: hidden;
}

@media (min-width: 560px) {
    .webstory-frame { max-width: 420px; height: min(100vh, 860px); margin: env(safe-area-inset-top, 0) auto; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
}

/* ---- Progress bars ---- */

.webstory-progress-row {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    z-index: 5;
}

.webstory-progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, .35);
    border-radius: 2px;
    overflow: hidden;
}

.webstory-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 2px;
}

.webstory-progress-bar.is-complete .webstory-progress-fill { width: 100%; }

/* ---- Top bar: logo, pause, share, close ---- */

.webstory-topbar {
    position: absolute;
    top: 22px;
    left: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 5;
}

.webstory-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

.webstory-logo img { height: 22px; width: auto; }

.webstory-topbar-actions { display: flex; align-items: center; gap: 8px; }

.webstory-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .35);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
}

.webstory-icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Slides ---- */

.webstory-slides { position: relative; width: 100%; height: 100%; }

.webstory-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease;
}

.webstory-slide.is-active { opacity: 1; visibility: visible; z-index: 2; }

@media (prefers-reduced-motion: reduce) {
    .webstory-slide { transition: none; }
}

.webstory-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.webstory-caption {
    position: absolute;
    left: 14px;
    right: 14px;
    padding: 16px 18px;
    border-radius: 16px;
    background: var(--brand-navy);
    border: 2px solid rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 20px;
    line-height: 1.55;
    z-index: 3;
}

@media (min-width: 400px) {
    .webstory-caption { font-size: 22px; }
}

.webstory-caption-bottom { bottom: 22px; }
.webstory-caption-top { top: 64px; }

/* ---- Prev/next arrows (desktop only) ---- */

.webstory-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 6;
    color: var(--brand-navy);
}

.webstory-nav-arrow svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 900px) {
    .webstory-nav-arrow { display: flex; }
    .webstory-nav-prev { left: calc(50% - 280px); }
    .webstory-nav-next { right: calc(50% - 280px); }
}

/* ---- Tap zones (invisible, cover the frame) ---- */

.webstory-tap-zones { position: absolute; inset: 0; display: flex; z-index: 4; }
.webstory-tap-prev { width: 33%; height: 100%; }
.webstory-tap-next { width: 67%; height: 100%; }

/* ---- End card ---- */

.webstory-endcard {
    position: absolute;
    inset: 0;
    z-index: 7;
    background: var(--brand-navy);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 70px 20px 24px;
    overflow-y: auto;
}

.webstory-endcard h2 { font-size: 20px; margin: 0 0 16px; }

.webstory-endcard-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

.webstory-endcard-item {
    display: flex;
    gap: 12px;
    align-items: center;
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, .08);
    border-radius: 10px;
    padding: 8px;
}

.webstory-endcard-item img { width: 50px; height: 88px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }

.webstory-endcard-item span { font-size: 14px; line-height: 1.4; }

.webstory-endcard-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.webstory-endcard-actions button,
.webstory-endcard-actions a {
    display: block;
    text-align: center;
    padding: 12px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.webstory-replay-btn { background: var(--brand-red); color: #fff; }
.webstory-home-link { background: rgba(255,255,255,.12); color: #fff; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.webstory-noscript-list {
    position: relative;
    z-index: 10;
    background: #fff;
    color: #111;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.webstory-noscript-list img { width: 100%; height: auto; border-radius: 10px; margin-bottom: 8px; }
.webstory-noscript-list section { margin-bottom: 28px; }
