/* ============================================
   OUR LOVE STORY — Two-Page Manuscript Spread
   Left page: Chapters I-III | Right page: Chapters IV-V
   No scrolling — all content fits within fixed pages.
   ============================================ */

/* Disable scroll on both faces of story page */
.book-page[data-page-index="4"] .book-page-content {
    overflow: hidden;
}

.book-page[data-page-index="3"] .book-page-back-content,
.book-page[data-page-index="4"] .book-page-back-content {
    overflow: hidden;
}

/* Apply story background to left page (Page 3's back face, visible when viewing page 4 spread) */
.book-page[data-page-index="3"] .book-page-back {
    background-image: url('/images/backgrounds/story-bg-v2.jpg');
    background-size: cover;
    background-position: center;
}

/* Also keep for page 4 back face (visible when viewing page 5 spread) */
.book-page[data-page-index="4"] .book-page-back {
    background-image: url('/images/backgrounds/story-bg-v2.jpg');
    background-size: cover;
    background-position: center;
}

.story-content {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* --- Title with Floral Wreath (sits above card, on the background) --- */
.story-title-wrap {
    position: relative;
    text-align: center;
    margin: 0 0 1.5rem;
    z-index: 3;
    flex-shrink: 0;
}

.story-wreath {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 120px;
    pointer-events: none;
}

.wreath-bloom,
.wreath-leaf {
    opacity: 0;
    animation: wreath-bloom-in 0.8s ease-out forwards;
}

.wreath-bloom--1, .wreath-leaf--1 { animation-delay: 0.2s; }
.wreath-bloom--2, .wreath-leaf--2 { animation-delay: 0.35s; }
.wreath-bloom--3, .wreath-leaf--3 { animation-delay: 0.5s; }
.wreath-bloom--4, .wreath-leaf--4 { animation-delay: 0.65s; }
.wreath-bloom--5, .wreath-leaf--5 { animation-delay: 0.3s; }
.wreath-bloom--6, .wreath-leaf--6 { animation-delay: 0.45s; }
.wreath-bloom--7, .wreath-leaf--7 { animation-delay: 0.6s; }
.wreath-bloom--8, .wreath-leaf--8 { animation-delay: 0.75s; }

@keyframes wreath-bloom-in {
    0% { opacity: 0; transform: scale(0.3); }
    60% { opacity: 0.7; transform: scale(1.1); }
    100% { opacity: var(--bloom-target-opacity, 0.5); transform: scale(1); }
}

.story-heading {
    font-family: var(--font-script);
    font-size: 2rem;
    color: #1c1209;
    text-align: center;
    margin: 0 0 0.15rem;
    font-weight: 400;
    line-height: 1.2;
    text-shadow:
        0 1px 2px rgba(28, 18, 9, 0.15),
        0 0 8px rgba(250, 240, 225, 0.6);
    position: relative;
    z-index: 1;
}

/* --- Story Card (single unified panel with scrollable content) --- */
.story-scroll {
    max-width: 560px;
    width: 90%;
    height: auto;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
    /* Layout */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0.5rem 1.5rem 0.5rem;
}

/* No scrollbar needed — content fits within fixed page */

/* --- Scroll chevron indicator --- */
.story-scroll-indicator {
    position: sticky;
    bottom: 12px;
    z-index: 4;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.4s ease;
    flex-shrink: 0;
}

.story-scroll-indicator svg {
    width: 20px;
    height: 20px;
    opacity: 0.4;
    animation: story-scroll-hint 2s ease-in-out infinite;
}

@keyframes story-scroll-hint {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50%      { transform: translateY(4px); opacity: 0.6; }
}

/* --- Chapter Block (inside scrollable card) --- */
.story-chapter {
    text-align: center;
    padding: 0.2rem 0.5rem;
    animation: story-chapter-reveal 0.8s ease-out both;
    /* No individual background — card provides it */
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    -webkit-mask-image: none;
    mask-image: none;
}

.story-chapter--1 { animation-delay: 0.1s; }
.story-chapter--2 { animation-delay: 0.2s; }
.story-chapter--3 { animation-delay: 0.3s; }
.story-chapter--4 { animation-delay: 0.4s; }
.story-chapter--5 { animation-delay: 0.5s; }

@keyframes story-chapter-reveal {
    0% { opacity: 0; transform: translateY(18px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* --- Chapter Marker (Roman Numeral) --- */
.story-chapter-marker {
    margin-bottom: 0.15rem;
}

.chapter-numeral {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #c17c74;
    letter-spacing: 3px;
    text-shadow: 0 0 8px rgba(193, 124, 116, 0.3);
    display: inline-block;
    position: relative;
}

.chapter-numeral::before,
.chapter-numeral::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 28px;
    height: 1px;
    background: linear-gradient(to var(--dir, right), rgba(193, 124, 116, 0.35), transparent);
}

.chapter-numeral::before {
    right: calc(100% + 10px);
    --dir: right;
}

.chapter-numeral::after {
    left: calc(100% + 10px);
    --dir: left;
}

/* --- Story Text (Cormorant Garamond on watercolor) --- */
.story-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem;
    font-weight: 400;
    font-style: normal;
    line-height: 1.55;
    color: #1c1209;
    margin: 0;
    text-shadow: 0 0 1px rgba(28, 18, 9, 0.15);
    font-feature-settings: "liga" 1, "kern" 1;
    letter-spacing: 0.2px;
}

/* --- Botanical Dividers --- */
.story-botanical-divider {
    text-align: center;
    margin: 0.2rem 0;
    opacity: 0.7;
}

.story-botanical-divider svg {
    width: 80px;
    height: 40px;
}

/* --- Warm overlay for both pages --- */
.story-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(250, 240, 225, 0.15) 0%,
        rgba(250, 240, 225, 0.05) 40%,
        rgba(250, 240, 225, 0.05) 60%,
        rgba(250, 240, 225, 0.18) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* --- Continuation hint (left page bottom) --- */
.story-continuation {
    text-align: right;
    font-family: var(--font-manuscript-body);
    font-style: italic;
    font-size: 0.75rem;
    color: #c17c74;
    opacity: 0.6;
    margin-top: 0.5rem;
    padding-right: 0.5rem;
}

/* --- Closing emblem (right page bottom) --- */
.story-closing {
    text-align: center;
    margin-top: 0.8rem;
    position: relative;
    z-index: 1;
}

.story-closing-emblem svg {
    width: 80px;
    height: 50px;
}

.story-closing-text {
    font-family: var(--font-script);
    font-size: 1rem;
    color: #c17c74;
    margin-top: 0.3rem;
    text-shadow: 0 0 6px rgba(193, 124, 116, 0.2);
}

/* --- Ink Bleed Ambient Spots --- */
.story-ink-bleeds {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.story-ink-bleed {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 196, 188, 0.12) 0%, transparent 70%);
    animation: ink-bleed-pulse 8s ease-in-out infinite;
    opacity: 0;
}

.story-ink-bleed--1 { width: 80px; height: 80px; top: 15%; left: 10%; animation-delay: 0s; }
.story-ink-bleed--2 { width: 60px; height: 60px; top: 40%; right: 8%; animation-delay: 2s; }
.story-ink-bleed--3 { width: 70px; height: 70px; bottom: 25%; left: 15%; animation-delay: 4s; }
.story-ink-bleed--4 { width: 50px; height: 50px; bottom: 10%; right: 12%; animation-delay: 6s; }

@keyframes ink-bleed-pulse {
    0%, 100% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* --- Drifting Feather --- */
.story-feather {
    position: absolute;
    top: -5%;
    right: 20%;
    pointer-events: none;
    z-index: 1;
    animation: feather-drift 30s ease-in-out infinite;
    opacity: 0;
}

.story-feather-svg {
    width: 24px;
    height: 48px;
}

@keyframes feather-drift {
    0% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
    5% { opacity: 0.5; }
    45% { opacity: 0.4; transform: translate(-60px, 70vh) rotate(25deg); }
    50% { opacity: 0; transform: translate(-70px, 80vh) rotate(30deg); }
    100% { opacity: 0; transform: translate(-70px, 80vh) rotate(30deg); }
}

/* --- Story Water Mist --- */
.story-mist {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.story-mist-wisp {
    position: absolute;
    bottom: 0;
    width: 120%;
    height: 40px;
    background: linear-gradient(90deg, transparent, rgba(255, 252, 248, 0.08), rgba(255, 252, 248, 0.06), transparent);
    filter: blur(8px);
    animation: mist-drift 30s linear infinite;
}

.story-mist-wisp--1 { bottom: 10%; animation-delay: 0s; }
.story-mist-wisp--2 { bottom: 25%; animation-delay: 15s; opacity: 0.6; }

@keyframes mist-drift {
    0% { transform: translateX(10%); }
    100% { transform: translateX(-110%); }
}

/* --- Water Ripples --- */

.story-ripples {
    position: absolute;
    bottom: 5%;
    left: 0;
    right: 0;
    height: 30%;
    pointer-events: none;
    z-index: 0;
}

.water-ripple {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(200, 220, 240, 0.25);
    animation: water-ripple-expand 5s ease-out infinite;
    opacity: 0;
}

.water-ripple--1 { bottom: 40%; left: 35%; animation-delay: 0s; animation-duration: 4.5s; }
.water-ripple--2 { bottom: 50%; left: 55%; animation-delay: 2s; animation-duration: 5.5s; }
.water-ripple--3 { bottom: 30%; left: 45%; animation-delay: 3.5s; animation-duration: 4s; }
.water-ripple--4 { bottom: 60%; left: 25%; animation-delay: 5s; animation-duration: 6s; }

@keyframes water-ripple-expand {
    0% { width: 4px; height: 4px; opacity: 0.3; transform: translate(-50%, -50%) scale(0); }
    60% { opacity: 0.15; }
    100% { width: 80px; height: 30px; opacity: 0; transform: translate(-50%, -50%) scale(2.5); }
}

/* --- Story Fireflies --- */

.story-fireflies {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.story-firefly {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 196, 160, 0.7) 0%, rgba(193, 124, 116, 0.25) 40%, transparent 70%);
    opacity: 0;
}

/* Fireflies concentrated near bottom (water area) */
.story-firefly--1  { width: 4px; height: 4px; bottom: 18%; left: 30%; animation: story-ff-meander 4.2s ease-in-out 0.3s infinite; }
.story-firefly--2  { width: 3px; height: 3px; bottom: 22%; left: 45%; animation: story-ff-glow 3.5s ease-in-out 1.0s infinite; }
.story-firefly--3  { width: 5px; height: 5px; bottom: 15%; left: 55%; animation: story-ff-meander 5.0s ease-in-out 2.0s infinite; }
.story-firefly--4  { width: 3px; height: 3px; bottom: 25%; left: 65%; animation: story-ff-glow 3.8s ease-in-out 0.7s infinite; }
.story-firefly--5  { width: 4px; height: 4px; bottom: 20%; left: 38%; animation: story-ff-meander 4.5s ease-in-out 3.0s infinite; }
.story-firefly--6  { width: 3px; height: 3px; bottom: 28%; left: 52%; animation: story-ff-glow 3.2s ease-in-out 1.5s infinite; }
.story-firefly--7  { width: 5px; height: 5px; bottom: 12%; left: 42%; animation: story-ff-meander 4.8s ease-in-out 0.5s infinite; }
.story-firefly--8  { width: 4px; height: 4px; bottom: 30%; left: 60%; animation: story-ff-glow 4.0s ease-in-out 2.5s infinite; }
.story-firefly--9  { width: 3px; height: 3px; bottom: 16%; left: 25%; animation: story-ff-meander 3.6s ease-in-out 1.8s infinite; }
.story-firefly--10 { width: 4px; height: 4px; bottom: 24%; left: 70%; animation: story-ff-glow 4.2s ease-in-out 3.5s infinite; }
/* Scattered higher */
.story-firefly--11 { width: 3px; height: 3px; bottom: 40%; left: 20%; animation: story-ff-glow 3.4s ease-in-out 0.8s infinite; }
.story-firefly--12 { width: 4px; height: 4px; bottom: 45%; right: 25%; animation: story-ff-meander 4.0s ease-in-out 2.2s infinite; }
.story-firefly--13 { width: 3px; height: 3px; bottom: 35%; left: 75%; animation: story-ff-glow 3.0s ease-in-out 1.2s infinite; }
.story-firefly--14 { width: 5px; height: 5px; bottom: 32%; left: 15%; animation: story-ff-meander 5.2s ease-in-out 0.4s infinite; }
.story-firefly--15 { width: 3px; height: 3px; bottom: 38%; right: 15%; animation: story-ff-glow 3.6s ease-in-out 2.8s infinite; }
.story-firefly--16 { width: 4px; height: 4px; bottom: 10%; left: 48%; animation: story-ff-meander 4.4s ease-in-out 1.6s infinite; }
.story-firefly--17 { width: 3px; height: 3px; bottom: 42%; left: 58%; animation: story-ff-glow 3.8s ease-in-out 3.2s infinite; }
.story-firefly--18 { width: 4px; height: 4px; bottom: 26%; right: 30%; animation: story-ff-meander 4.6s ease-in-out 0.9s infinite; }

@keyframes story-ff-glow {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.65; }
}

@keyframes story-ff-meander {
    0%, 100% { opacity: 0; transform: translate(0, 0); }
    25% { opacity: 0.5; transform: translate(4px, -3px); }
    50% { opacity: 0.7; transform: translate(-2px, -6px); }
    75% { opacity: 0.4; transform: translate(5px, -2px); }
}

