/* «DogPlan Сторіз» (NEED-007) — home rail + fullscreen viewer.
   Brand-consistent with the site (Nunito, orange/teal). Familiar IG/comfy-style stories;
   no bespoke identity — the format itself is the signature. */

/* ---- Rail (under header, before hero) ------------------------------------- */
#storiesRail {
    display: none;                 /* revealed by JS only when there are active stories */
}
#storiesRail.dp-stories--ready {
    display: block;
}
.dp-stories-rail {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 14px 16px;
    max-width: 56rem;              /* align with hero container (max-w-4xl) */
    margin: 0 auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.dp-stories-rail::-webkit-scrollbar { display: none; }

.dp-story {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 76px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}
/* Gradient ring for unseen; muted grey ring once viewed. */
.dp-story-ring {
    width: 68px;
    height: 68px;
    border-radius: 9999px;
    padding: 3px;
    background: linear-gradient(135deg, #f97316, #fbbf24);
    display: grid;
    place-items: center;
    transition: transform .15s ease;
}
.dp-story.is-seen .dp-story-ring {
    background: #d1d5db;
}
.dp-story:hover .dp-story-ring,
.dp-story:focus-visible .dp-story-ring {
    transform: scale(1.05);
}
.dp-story:focus-visible {
    outline: 2px solid #0d9488;
    outline-offset: 3px;
    border-radius: 12px;
}
.dp-story-cover {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    background: #fff;               /* white gap between ring and cover */
    border: 2px solid #fff;
    display: grid;
    place-items: center;
    font-size: 28px;
    overflow: hidden;
}
.dp-story-label {
    font-size: 12px;
    line-height: 1.2;
    color: #374151;
    text-align: center;
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ---- Fullscreen viewer ---------------------------------------------------- */
.dp-viewer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}
.dp-viewer[hidden] { display: none; }

.dp-viewer-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 90vh;
    border-radius: 16px;
    overflow: hidden;
    background: #111;
    display: flex;
    flex-direction: column;
    color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
@media (max-width: 480px) {
    .dp-viewer-card { max-height: 100vh; border-radius: 0; }
}

/* Progress bars */
.dp-viewer-bars {
    display: flex;
    gap: 4px;
    padding: 10px 12px 4px;
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 3;
}
.dp-bar {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .35);
    overflow: hidden;
}
.dp-bar-fill {
    display: block;
    height: 100%;
    width: 0;
    background: #fff;
    border-radius: 3px;
}
.dp-bar.is-done .dp-bar-fill { width: 100%; }
.dp-bar.is-active .dp-bar-fill {
    animation: dp-bar-grow var(--dp-slide-ms, 5000ms) linear forwards;
}
@keyframes dp-bar-grow { from { width: 0; } to { width: 100%; } }

/* Slide content */
.dp-slide {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 28px 24px 32px;
    background-size: cover;
    background-position: center;
}
.dp-slide-emoji { font-size: 56px; margin-bottom: auto; padding-top: 40px; }
.dp-slide-title {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 10px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .45);
}
.dp-slide-text {
    font-size: 15px;
    line-height: 1.4;
    margin-bottom: 18px;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .45);
}
.dp-slide-cta {
    align-self: flex-start;
    position: relative;   /* above the prev/next tap zones so it stays clickable */
    z-index: 3;
    background: #fff;
    color: #111;
    font-weight: 700;
    font-size: 15px;
    padding: 12px 22px;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: transform .15s ease;
}
.dp-slide-cta:hover { transform: translateY(-2px); }

/* Tap zones (prev/next) + close */
.dp-tap {
    position: absolute;
    top: 0; bottom: 0;
    width: 33%;
    z-index: 2;
    background: none;
    border: none;
    cursor: pointer;
}
.dp-tap-prev { left: 0; }
.dp-tap-next { right: 0; }
.dp-viewer-close {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 4;
    width: 36px; height: 36px;
    border-radius: 9999px;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.dp-viewer-close:focus-visible,
.dp-slide-cta:focus-visible {
    outline: 2px solid #2dd4bf;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .dp-bar.is-active .dp-bar-fill { animation: none; width: 100%; }
    .dp-story-ring, .dp-slide-cta { transition: none; }
}
