/* ============================================
   MY STORY PAGE - STYLES
   Chapter-based narrative with vintage elegance
   ============================================ */

/* ============================================
   STORY HERO SECTION
   ============================================ */

.story-hero-section {
    position: relative;
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, 
        var(--bg-primary) 0%, 
        var(--bg-secondary) 30%,
        var(--bg-tertiary) 60%,
        var(--bg-accent) 100%);
    overflow: hidden;
    padding: 6rem 0;
}

/* Add subtle vignette effect */
.story-hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        rgba(0, 0, 0, 0.05) 100%
    );
    pointer-events: none;
}

.story-hero-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2.5rem;
    width: 100%;
    position: relative;
    z-index: 1;
}

.story-hero-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 5rem;
    align-items: center;
}

.story-hero-portrait {
    position: relative;
    z-index: 10;
}

.story-hero-portrait 

.portrait-caption {
    text-align: center;
    font-style: italic;
    font-size: 0.9375rem;
    color: var(--text-tertiary);
    margin-top: 1rem;
}

.story-hero-text {
    max-width: 600px;
}

.story-hero-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(3rem, 6vw, 4.5rem);
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.story-hero-intro {
    margin: 2rem 0;
}

.hero-quote {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.375rem, 2.5vw, 1.75rem);
    font-style: italic;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

.hero-subtext {
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--text-primary);
    text-align: center;
    max-width: 550px;
    margin: 0 auto;
}


.scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    color: var(--text-tertiary);
    font-size: 0.9375rem;
    font-family: 'Libre Baskerville', Georgia, serif;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: bounce 2s ease-in-out infinite;
}

.scroll-indicator svg {
    opacity: 0.5;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(10px);
    }
}

/* ============================================
   CHAPTER SECTIONS
   ============================================ */

.life-chapter {
    position: relative;
    padding: 6rem 0;
}

/* Dynamic backgrounds that tell Mary's emotional story */

/* Chapter 1: The Beginning - Neutral, humble start */
.chapter-1 {
    background: linear-gradient(to bottom, 
        var(--bg-primary) 0%, 
        var(--bg-highlight) 100%);
}

/* Chapter 2: Finding My Craft - Warming up, hope emerging */
.chapter-2 {
    background: linear-gradient(135deg, 
        var(--bg-highlight) 0%, 
        var(--bg-secondary) 50%,
        var(--bg-highlight) 100%);
}

/* Chapter 3: The Life I Built - Peak warmth, golden period */
.chapter-3 {
    background: linear-gradient(135deg, 
        var(--bg-secondary) 0%, 
        var(--bg-accent) 30%,
        var(--bg-secondary) 70%,
        var(--bg-tertiary) 100%);
}

/* Chapter 4: When Whispers Began - Cooling rapidly, unease */
.chapter-4 {
    background: linear-gradient(to bottom, 
        var(--bg-tertiary) 0%, 
        var(--bg-accent) 60%,
        var(--bg-tertiary) 100%);
}

/* Chapter 5: The Weight of Misfortune - Heavy, oppressive, darker */
.chapter-5 {
    background: linear-gradient(135deg, 
        var(--bg-accent) 0%, 
        var(--bg-tertiary) 100%);
}

/* Chapter 6: Trying to Survive - Darkest, most desperate */
.chapter-6 {
    background-color: var(--bg-accent);
}

/* Chapter 7: The Return - Brief hope, then crash back down */
.chapter-7 {
    background: linear-gradient(to bottom, 
        var(--bg-tertiary) 0%, 
        var(--bg-secondary) 20%,
        var(--bg-accent) 100%);
}

/* Chapter 8: Exile - Long, settled darkness with slight variation */
.chapter-8 {
    background: linear-gradient(to bottom, 
        var(--bg-accent) 0%, 
        var(--bg-tertiary) 40%,
        var(--bg-accent) 100%);
}

/* Chapter 9: What They Never Told You - Dramatic return to light, clarity */
.chapter-9 {
    background: linear-gradient(to bottom, 
        var(--bg-accent) 0%, 
        var(--bg-tertiary) 20%,
        var(--bg-secondary) 50%,
        var(--bg-highlight) 80%,
        var(--bg-primary) 100%);
}

/* Add subtle texture overlay to all chapters */
.life-chapter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.01) 2px,
            rgba(0, 0, 0, 0.01) 4px
        );
    pointer-events: none;
    opacity: 0.3;
}

.chapter-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2.5rem;
    position: relative;
    z-index: 1;
}

.chapter-layout {
    display: grid;
    gap: 5rem;
    align-items: start;
}

.chapter-layout.image-left {
    grid-template-columns: 450px 1fr;
}

.chapter-layout.image-right {
    grid-template-columns: 1fr 450px;
}

.chapter-layout.image-right .chapter-content {
    order: 1;
}

.chapter-layout.image-right .chapter-image-wrapper {
    order: 2;
}

/* ============================================
   CHAPTER IMAGES & FRAMES
   ============================================ */

.chapter-image-wrapper {
    position: relative;
}

.chapter-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 4/5;
    background: linear-gradient(135deg, 
        var(--bg-tertiary) 0%, 
        var(--bg-accent) 100%);
    padding: 16px;
    box-shadow: 
        0 20px 60px var(--shadow-deep),
        inset 0 0 0 1px var(--border-dark);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* iOS Safari fix: clip image to frame */
    overflow: hidden;
}

.chapter-frame:hover {
    transform: scale(1.02);
}

.chapter-image {
    /* Absolute inset so iOS Safari respects aspect-ratio parent dimensions */
    position: absolute;
    inset: 16px; /* matches frame padding */
    background: linear-gradient(135deg,
        #8B7869 0%,
        #A89888 50%,
        #8B7869 100%);
    overflow: hidden;
}

.chapter-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Image placeholder styling */
.image-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        var(--bg-tertiary) 0%,
        var(--bg-accent) 100%);
}

.placeholder-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 0.875rem;
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
    opacity: 0.6;
    line-height: 1.6;
}

.image-caption {
    text-align: center;
    font-style: italic;
    font-size: 0.9375rem;
    color: var(--text-tertiary);
    margin-top: 1rem;
}

/* ============================================
   CHAPTER CONTENT
   ============================================ */

.chapter-content {
    position: relative;
}

.chapter-header {
    margin-bottom: 2.5rem;
}

.chapter-number {
    display: block;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 0.8125rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.chapter-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.chapter-years {
    display: block;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.125rem;
    font-style: italic;
    color: var(--text-tertiary);
}

.chapter-narrative {
    margin: 2.5rem 0;
}

.chapter-narrative p {
    font-size: 1.125rem;
    line-height: 1.85;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* ============================================
   CHAPTER PULL QUOTES
   ============================================ */

.chapter-quote {
    position: relative;
    max-width: 100%;
    margin: 3rem 0;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, 
        var(--bg-highlight) 0%, 
        var(--bg-accent) 100%);
    border-left: 4px solid var(--accent-gold);
    box-shadow: 0 8px 30px var(--shadow-vintage);
}

.chapter-quote .quote-mark {
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 5rem;
    font-weight: 700;
    color: var(--accent-gold);
    opacity: 0.2;
    line-height: 1;
}

.chapter-quote .quote-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    font-style: italic;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    padding-left: 2rem;
}

/* ============================================
   CHAPTER CTA BUTTONS (ARTICLE LINKS)
   ============================================ */

.chapter-cta {
    margin-top: 3rem;
}

.article-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: 0.9375rem;
    color: var(--accent-sepia);
    background-color: transparent;
    border: 2px solid var(--border-medium);
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.article-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        var(--bg-highlight), 
        transparent);
    transition: left 0.5s ease;
}

.article-button:hover::before {
    left: 100%;
}

.article-button:hover,
.article-button:focus {
    border-color: var(--accent-gold);
    color: var(--accent-rust);
    transform: translateX(4px);
    background-color: var(--bg-highlight);
}

.button-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.article-button:hover .button-icon {
    transform: scale(1.1);
}

.button-arrow {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

.article-button:hover .button-arrow {
    transform: translateX(4px);
}

/* ============================================
   CHAPTER DIVIDERS (ON THE SEAM)
   ============================================ */

.chapter-divider {
    position: relative;
    height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.chapter-divider::before,
.chapter-divider::after {
    content: '';
    position: absolute;
    top: 0;
    width: 40%;
    height: 1px;
    background: linear-gradient(to right, 
        transparent, 
        var(--accent-gold), 
        transparent);
    opacity: 0.4;
}

.chapter-divider::before {
    left: 0;
}

.chapter-divider::after {
    right: 0;
}

.divider-ornament {
    display: inline-block;
    font-size: 1.5rem;
    color: var(--accent-gold);
    opacity: 0.7;
    background-color: var(--bg-primary);
    padding: 0.5rem 1.5rem;
    position: relative;
    z-index: 2;
}

/* ============================================
   FINAL REFLECTION SECTION
   ============================================ */

.final-reflection {
    position: relative;
    padding: 6rem 0;
    background: linear-gradient(135deg, 
        var(--bg-accent) 0%, 
        var(--bg-tertiary) 30%,
        var(--bg-secondary) 70%,
        var(--bg-primary) 100%);
    border-top: 2px solid var(--accent-gold);
}

.reflection-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

.reflection-text {
    margin: 3rem 0;
}

.reflection-text p {
    font-size: 1.25rem;
    line-height: 1.85;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.signature-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 4rem 0;
}

.signature-line {
    width: 200px;
    height: 1px;
    background: var(--border-dark);
}

.signature-text {
    font-family: 'Mrs Saint Delafield', cursive;
    font-size: 3rem;
    color: var(--accent-sepia);
}

.signature-date {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1rem;
    font-style: italic;
    color: var(--text-tertiary);
}

.final-cta-group {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 3rem;
}

.cta-button.secondary {
    background-color: transparent;
    color: var(--accent-sepia);
    border: 2px solid var(--border-medium);
}

.cta-button.secondary:hover {
    background-color: var(--bg-highlight);
    border-color: var(--accent-gold);
}

/* ============================================
   RESPONSIVE - IPAD SPECIFIC (Keep Desktop Layout)
   ============================================ */

@media (min-width: 768px) and (max-width: 1024px) {
    .story-hero-section {
        min-height: auto;
        padding: 3.5rem 0 4.5rem;
    }
    
    .story-hero-container {
        padding: 0 2rem;
    }
    
    .story-hero-layout {
        grid-template-columns: 350px 1fr;
        gap: 4rem;
    }
    
    .story-hero-portrait .portrait-vintage-frame {
        max-width: 350px;
    }
    
    /* Keep side-by-side layout for chapters on iPad */
    .chapter-layout.image-left {
        grid-template-columns: 380px 1fr;
        gap: 4rem;
    }
    
    .chapter-layout.image-right {
        grid-template-columns: 1fr 380px;
        gap: 4rem;
    }
    
    .chapter-frame {
        max-width: 380px;
    }
}

/* ============================================
   RESPONSIVE - SMALL TABLET
   ============================================ */

@media (max-width: 767px) {
    .story-hero-section {
        min-height: auto;
        padding: 4rem 0 5rem;
    }
    
    .story-hero-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }
    
    .story-hero-portrait .portrait-vintage-frame {
        max-width: 350px;
        margin: 0 auto;
    }
    
    .chapter-layout.image-left,
    .chapter-layout.image-right {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .chapter-layout.image-right .chapter-content {
        order: 2;
    }
    
    .chapter-layout.image-right .chapter-image-wrapper {
        order: 1;
    }
    
    .chapter-frame {
        max-width: 400px;
        margin: 0 auto;
    }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .story-hero-section {
        min-height: auto;
        padding: 3rem 0;
    }
    
    .story-hero-container {
        padding: 0 1.5rem;
    }
    
    .story-hero-layout {
        gap: 2rem;
    }
    
    .story-hero-portrait .portrait-vintage-frame {
        max-width: 300px;
    }
    
    .story-hero-title {
        font-size: 2.5rem;
    }
    
    .hero-quote {
        font-size: 1.25rem;
    }
    
    .hero-subtext {
        font-size: 1rem;
    }
    
    .life-chapter {
        padding: 3rem 0;
    }
    
    .chapter-container {
        padding: 0 1.5rem;
    }
    
    .chapter-layout {
        gap: 2rem;
    }
    
    .chapter-frame {
        max-width: 100%;
        aspect-ratio: 3/4;
        padding: 12px;
    }
    
    .chapter-title {
        font-size: 1.875rem;
    }
    
    .chapter-narrative p {
        font-size: 1.0625rem;
    }
    
    .chapter-quote {
        padding: 2rem 1.5rem;
    }
    
    .chapter-quote .quote-text {
        font-size: 1.125rem;
        padding-left: 1.5rem;
    }
    
    .chapter-quote .quote-mark {
        font-size: 4rem;
        left: 0.5rem;
    }
    
    .article-button {
        width: 100%;
        justify-content: center;
        padding: 1rem 1.5rem;
        font-size: 0.875rem;
    }
    
    .chapter-separator {
        margin: 3rem 0;
    }
    
    .final-reflection {
        padding: 4rem 0;
    }
    
    .reflection-text p {
        font-size: 1.0625rem;
    }
    
    .signature-text {
        font-size: 2.5rem;
    }
    
    .final-cta-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .final-cta-group .cta-button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .story-hero-container,
    .chapter-container {
        padding: 0 1rem;
    }
    
    .story-hero-title {
        font-size: 2rem;
    }
    
    .chapter-title {
        font-size: 1.625rem;
    }
    
    .chapter-frame {
        padding: 10px;
    }
}

/* ============================================
   ACCESSIBILITY & MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .scroll-indicator { animation: none; }
    .chapter-frame:hover { transform: none; }
    .article-button::before { transition: none; }
}

/* Footer styling handled by main.css */
