/* =============================================================
   FableFactory — Fairy-Tale Design System
   Mirrors the Angular SPA visual language for Razor Pages
   ============================================================= */

/* ---------------------------------------------------------------
   PHASE 1 — Design System Foundation
   Task 1: CSS Variables and Global Animations
--------------------------------------------------------------- */

/* Google Fonts are loaded via <link> tags in _Layout.cshtml */

:root {
    /* Primary palette */
    --ff-primary:          #9b7ed9;
    --ff-primary-light:    #c9a0dc;
    --ff-primary-dark:     #7a5dc7;

    /* Secondary / CTA */
    --ff-secondary:        #f9a875;
    --ff-secondary-dark:   #f08a50;

    /* Accent */
    --ff-accent-pink:      #f8b4d9;
    --ff-accent-yellow:    #f7c97e;

    /* Backgrounds */
    --ff-bg-lavender:      #e8d5f0;
    --ff-bg-cream:         #fff5e6;

    /* Gradients */
    --ff-gradient-primary: linear-gradient(135deg, #9b7ed9 0%, #c9a0dc 100%);
    --ff-gradient-cta:     linear-gradient(135deg, #f9a875 0%, #f7c97e 100%);
    --ff-gradient-hero:    linear-gradient(135deg, #e8d5f0 0%, #fff5e6 100%);
    --ff-gradient-magic:   linear-gradient(135deg, #9b7ed9 0%, #f8b4d9 50%, #f7c97e 100%);

    /* Text */
    --ff-text-primary:     #4a3f5c;
    --ff-text-secondary:   #7a6b8a;
    --ff-text-muted:       #9b8ba8;

    /* Shadows */
    --ff-shadow-sm:  0 2px 8px rgba(155, 126, 217, 0.12);
    --ff-shadow-md:  0 4px 20px rgba(155, 126, 217, 0.18);
    --ff-shadow-lg:  0 8px 40px rgba(155, 126, 217, 0.25);
    --ff-shadow-glow: 0 0 30px rgba(155, 126, 217, 0.4);

    /* Border radii */
    --ff-radius-sm:   6px;
    --ff-radius-md:   10px;
    --ff-radius-lg:   16px;
    --ff-radius-xl:   20px;
    --ff-radius-2xl:  24px;
    --ff-radius-pill: 50px;

    /* Font families */
    --ff-font-story:   'Literata', Georgia, serif;
    --ff-font-heading: 'Piazzolla', 'Times New Roman', serif;
    --ff-font-button:  'Montserrat', system-ui, sans-serif;

    /* Transitions */
    --ff-transition-base: all 0.2s ease;
    --ff-transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global keyframe animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

@keyframes sparkle {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(1.2); opacity: 0.8; }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.2); }
}

@keyframes moveClouds {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}

/* ---------------------------------------------------------------
   PHASE 1 — Task 2: Global Layout and Typography Baseline
--------------------------------------------------------------- */

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--ff-font-button);
    color: var(--ff-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--ff-gradient-hero);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--ff-font-heading);
}

/* Global button overrides */
.btn-primary {
    background: var(--ff-gradient-cta);
    border: none;
    color: white;
    border-radius: var(--ff-radius-pill);
    font-family: var(--ff-font-button);
    font-weight: 600;
    padding: 0.625rem 1.5rem;
    box-shadow: 0 4px 15px rgba(249, 168, 117, 0.35);
    transition: var(--ff-transition-smooth);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--ff-gradient-cta);
    border: none;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 168, 117, 0.45);
}

.btn-outline-primary {
    border: 2px solid var(--ff-primary);
    color: var(--ff-primary);
    border-radius: var(--ff-radius-pill);
    font-weight: 600;
    transition: var(--ff-transition-smooth);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: var(--ff-gradient-primary);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
}

/* Progress bar color override */
.progress-bar {
    background: var(--ff-gradient-primary);
}

/* ---------------------------------------------------------------
   PHASE 2 — Task 4: Navbar CSS
--------------------------------------------------------------- */

.ff-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(243, 232, 255, 0.95));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(155, 126, 217, 0.1);
    box-shadow: 0 4px 20px rgba(155, 126, 217, 0.1);
    padding: 0.75rem 0;
}

.ff-navbar-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.ff-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex-shrink: 0;
}

.ff-brand-icon {
    position: relative;
    width: 44px;
    height: 44px;
    background: var(--ff-gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(155, 126, 217, 0.3);
    flex-shrink: 0;
}

.ff-sparkle {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: var(--ff-accent-yellow);
    border-radius: 50%;
    animation: sparkle 2s ease-in-out infinite;
}

.ff-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.ff-brand-name {
    font-family: var(--ff-font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--ff-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ff-brand-tagline {
    font-size: 0.7rem;
    color: var(--ff-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ff-login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--ff-gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--ff-radius-pill);
    padding: 0.625rem 1.25rem;
    font-family: var(--ff-font-button);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(155, 126, 217, 0.3);
    transition: var(--ff-transition-smooth);
    white-space: nowrap;
}

.ff-login-btn:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(155, 126, 217, 0.45);
}


/* ---------------------------------------------------------------
   PHASE 3 — Task 6: Footer CSS
--------------------------------------------------------------- */

.ff-footer {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #1a1033 0%, #2d1b4e 50%, #4a2c7a 100%);
    color: white;
    padding: 5rem 0 0;
    margin-top: auto;
}

/* Star layers */
.ff-footer-stars {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 40px 70px, white, transparent),
        radial-gradient(2px 2px at 80px 20px, white, transparent),
        radial-gradient(2px 2px at 120px 50px, white, transparent),
        radial-gradient(2px 2px at 160px 90px, white, transparent),
        radial-gradient(2px 2px at 200px 40px, white, transparent),
        radial-gradient(2px 2px at 240px 10px, white, transparent),
        radial-gradient(2px 2px at 280px 60px, white, transparent),
        radial-gradient(2px 2px at 320px 80px, white, transparent),
        radial-gradient(2px 2px at 50px 110px, white, transparent),
        radial-gradient(2px 2px at 100px 130px, white, transparent),
        radial-gradient(2px 2px at 150px 160px, white, transparent),
        radial-gradient(2px 2px at 220px 120px, white, transparent),
        radial-gradient(2px 2px at 300px 140px, white, transparent),
        radial-gradient(2px 2px at 340px 170px, white, transparent);
    background-size: 350px 200px;
    animation: twinkle 4s ease-in-out infinite;
    opacity: 0.6;
    pointer-events: none;
}

.ff-footer-stars-2 {
    background-image:
        radial-gradient(2px 2px at 30px 50px, #f7c97e, transparent),
        radial-gradient(2px 2px at 70px 20px, #f8b4d9, transparent),
        radial-gradient(2px 2px at 110px 80px, #d4e7fe, transparent),
        radial-gradient(2px 2px at 170px 30px, #f7c97e, transparent),
        radial-gradient(2px 2px at 210px 70px, white, transparent),
        radial-gradient(2px 2px at 260px 10px, #f8b4d9, transparent),
        radial-gradient(2px 2px at 310px 60px, #d4e7fe, transparent),
        radial-gradient(2px 2px at 360px 40px, #f7c97e, transparent),
        radial-gradient(2px 2px at 60px 140px, white, transparent),
        radial-gradient(2px 2px at 130px 100px, #f8b4d9, transparent),
        radial-gradient(2px 2px at 190px 150px, #d4e7fe, transparent),
        radial-gradient(2px 2px at 250px 120px, white, transparent),
        radial-gradient(2px 2px at 320px 180px, #f7c97e, transparent);
    background-size: 400px 250px;
    animation-delay: 1s;
    opacity: 0.5;
}

.ff-footer-clouds {
    position: absolute;
    bottom: 0;
    left: -100%;
    right: 0;
    height: 150px;
    background-image:
        radial-gradient(ellipse 100px 40px at 100px 80px, rgba(155, 126, 217, 0.15), transparent),
        radial-gradient(ellipse 80px 30px at 250px 100px, rgba(201, 160, 220, 0.12), transparent),
        radial-gradient(ellipse 120px 45px at 420px 70px, rgba(155, 126, 217, 0.1), transparent),
        radial-gradient(ellipse 90px 35px at 600px 90px, rgba(201, 160, 220, 0.13), transparent);
    background-size: 700px 150px;
    background-repeat: repeat-x;
    animation: moveClouds 60s linear infinite;
    opacity: 0.8;
    pointer-events: none;
}

.ff-footer-main {
    position: relative;
    z-index: 1;
    padding-bottom: 2rem;
}

.ff-footer-brand {
    margin-bottom: 2rem;
}

.ff-footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--ff-font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.ff-footer-logo i {
    color: var(--ff-primary-light);
}

.ff-footer-logo span {
    background: linear-gradient(135deg, #c9a0dc, #f8b4d9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ff-footer-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.ff-social-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ff-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    font-size: 1rem;
    transition: var(--ff-transition-smooth);
}

.ff-social-link:hover {
    background: var(--ff-primary-light);
    color: white;
    transform: translateY(-3px);
}

.ff-footer-links {
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.ff-footer-links h4 {
    font-family: var(--ff-font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1.25rem;
}

.ff-footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ff-footer-links ul li {
    margin-bottom: 0.625rem;
}

.ff-footer-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--ff-transition-smooth);
    display: inline-block;
}

.ff-footer-links a:hover {
    color: var(--ff-primary-light);
    padding-left: 5px;
}

.ff-footer-newsletter {
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.ff-footer-newsletter h4 {
    font-family: var(--ff-font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.75rem;
}

.ff-footer-newsletter p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.ff-newsletter-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ff-newsletter-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    border-radius: 25px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    outline: none;
    transition: background 0.2s;
    min-width: 0;
}

.ff-newsletter-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.ff-newsletter-input:focus {
    background: rgba(255, 255, 255, 0.25);
}

.ff-newsletter-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--ff-gradient-cta);
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--ff-transition-smooth);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ff-newsletter-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(249, 168, 117, 0.4);
}

.ff-footer-bottom {
    position: relative;
    z-index: 1;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem 0;
    margin-top: 1rem;
}

.ff-copyright {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.ff-heart-icon {
    color: var(--ff-accent-pink);
}

.ff-trust-badges {
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.ff-badge {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
}

.ff-badge i {
    color: var(--ff-accent-yellow);
}

/* ---------------------------------------------------------------
   PHASE 4 — Tasks 7-9: Share Page Story Content
--------------------------------------------------------------- */

/* Task 7: Story Header */
.ff-share-content {
    animation: fadeInUp 0.6s ease-out;
}

.ff-story-title {
    font-family: var(--ff-font-heading);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    background: var(--ff-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.ff-meta-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.ff-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(155, 126, 217, 0.1);
    color: var(--ff-text-secondary);
    border-radius: var(--ff-radius-pill);
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.ff-story-summary {
    font-family: var(--ff-font-story);
    font-size: 1.2rem;
    color: var(--ff-text-secondary);
    max-width: 700px;
    margin: 0 auto 1.5rem;
    line-height: 1.7;
    text-align: center;
}

.ff-story-divider {
    height: 3px;
    background: var(--ff-gradient-primary);
    border-radius: 3px;
    margin: 2rem auto;
    max-width: 80px;
}

/* Task 8: Illustration Cards */
.ff-story-pages {
    max-width: 800px;
    margin: 0 auto;
}

.ff-page-block {
    margin-bottom: 4rem;
}

.ff-page-block:last-child {
    margin-bottom: 2rem;
}

.ff-illustration-card {
    position: relative;
    background: white;
    border-radius: var(--ff-radius-2xl);
    box-shadow: var(--ff-shadow-md);
    border: 2px solid rgba(155, 126, 217, 0.1);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: var(--ff-transition-base);
    margin-bottom: 1.5rem;
    min-height: 200px;
}

.ff-illustration-card:hover {
    box-shadow: var(--ff-shadow-lg);
    transform: translateY(-2px);
}

.ff-story-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: var(--ff-radius-xl);
    animation: fadeInUp 0.5s ease-out;
    display: block;
    max-height: 600px;
}

.ff-image-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ff-bg-lavender) 0%, var(--ff-bg-cream) 100%);
    border-radius: var(--ff-radius-xl);
    color: var(--ff-text-muted);
    gap: 0.5rem;
    font-size: 0.9rem;
    pointer-events: none;
}

.ff-image-placeholder i {
    font-size: 2rem;
}

.ff-illustration-card.ff-image-error .ff-image-placeholder {
    display: flex;
}

/* Task 9: Text Cards */
.ff-page-number {
    text-align: center;
    font-size: 0.8rem;
    color: var(--ff-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.ff-text-card {
    background: white;
    border-radius: var(--ff-radius-2xl);
    box-shadow: var(--ff-shadow-md);
    border: 2px solid rgba(155, 126, 217, 0.1);
    padding: 2rem 2.5rem;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.5s ease-out;
}

.ff-story-text {
    font-family: var(--ff-font-story);
    font-size: 1.3rem;
    line-height: 1.9;
    color: var(--ff-text-primary);
    text-align: center;
    margin: 0;
    font-weight: 400;
    white-space: pre-wrap;
}

/* ---------------------------------------------------------------
   PHASE 5 — Tasks 10-11: CTA, Share Buttons, Toast
--------------------------------------------------------------- */

/* Task 10: CTA Card */
.ff-cta-card {
    background: linear-gradient(135deg, rgba(155, 126, 217, 0.08) 0%, rgba(201, 160, 220, 0.12) 100%);
    border: 2px solid rgba(155, 126, 217, 0.2);
    border-radius: var(--ff-radius-2xl);
    padding: 3rem 2rem;
    margin-bottom: 3rem;
    box-shadow: var(--ff-shadow-sm);
}

.ff-cta-icon {
    width: 70px;
    height: 70px;
    background: var(--ff-gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin: 0 auto 1.5rem;
    animation: float 3s ease-in-out infinite;
    box-shadow: var(--ff-shadow-md);
}

.ff-cta-title {
    font-family: var(--ff-font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ff-text-primary);
    margin-bottom: 0.75rem;
}

.ff-cta-description {
    color: var(--ff-text-secondary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.ff-btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--ff-gradient-cta);
    color: white;
    text-decoration: none;
    border-radius: var(--ff-radius-pill);
    padding: 0.875rem 2rem;
    font-family: var(--ff-font-button);
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(249, 168, 117, 0.4);
    transition: var(--ff-transition-smooth);
    border: none;
    cursor: pointer;
}

.ff-btn-cta:hover {
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(249, 168, 117, 0.5);
}

/* Task 10: Share Section */
.ff-share-section {
    text-align: center;
    margin-bottom: 3rem;
}

.ff-share-title {
    font-family: var(--ff-font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ff-text-primary);
    margin-bottom: 1.25rem;
}

.ff-share-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.ff-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--ff-radius-pill);
    font-family: var(--ff-font-button);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--ff-transition-smooth);
    white-space: nowrap;
}

.ff-share-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.ff-share-facebook {
    background: #1877f2;
    color: white;
}

.ff-share-twitter {
    background: #000000;
    color: white;
}

.ff-share-whatsapp {
    background: #25d366;
    color: white;
}

.ff-share-linkedin {
    background: #0a66c2;
    color: white;
}

.ff-share-copy {
    background: rgba(155, 126, 217, 0.12);
    color: var(--ff-primary);
    border: 2px solid rgba(155, 126, 217, 0.3);
}

.ff-share-copy:hover {
    background: var(--ff-gradient-primary);
    color: white;
    border-color: transparent;
}

/* Task 11: Toast */
.ff-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #2d1b4e, #4a2c7a);
    color: white;
    border-radius: var(--ff-radius-pill);
    padding: 0.875rem 1.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--ff-shadow-lg);
    z-index: 9999;
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
    white-space: nowrap;
}

.ff-toast.ff-toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ---------------------------------------------------------------
   PHASE 6 — Task 12: Error States
--------------------------------------------------------------- */

.ff-error-state {
    padding: 5rem 1rem;
}

.ff-error-icon {
    width: 100px;
    height: 100px;
    background: var(--ff-gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    margin: 0 auto 2rem;
    animation: float 3s ease-in-out infinite;
    box-shadow: var(--ff-shadow-lg);
}

.ff-error-icon.ff-error-icon-blocked {
    background: var(--ff-gradient-cta);
}

.ff-error-title {
    font-family: var(--ff-font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--ff-text-primary);
    margin-bottom: 1rem;
}

.ff-error-description {
    color: var(--ff-text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------------------------------------------------------------
   PHASE 7 — Task 13: Scroll-Triggered Animations
--------------------------------------------------------------- */

.ff-animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.ff-animate-on-scroll.ff-visible {
    opacity: 1;
    transform: none;
}

/* Stagger delays for page blocks */
.ff-page-block:nth-child(1) { transition-delay: 0s; }
.ff-page-block:nth-child(2) { transition-delay: 0.1s; }
.ff-page-block:nth-child(3) { transition-delay: 0.15s; }
.ff-page-block:nth-child(4) { transition-delay: 0.2s; }
.ff-page-block:nth-child(5) { transition-delay: 0.25s; }
.ff-page-block:nth-child(n+6) { transition-delay: 0.3s; }

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .ff-animate-on-scroll {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .ff-cta-icon,
    .ff-error-icon {
        animation: none;
    }

    .ff-sparkle {
        animation: none;
    }

    .ff-footer-stars,
    .ff-footer-stars-2 {
        animation: none;
    }

    .ff-footer-clouds {
        animation: none;
    }

    .ff-story-image {
        animation: none;
    }
}

/* ---------------------------------------------------------------
   PHASE 8 — Task 14: Blog / Insights Page Styles
--------------------------------------------------------------- */

.ff-cover-card {
    border-radius: var(--ff-radius-2xl);
    overflow: hidden;
    box-shadow: var(--ff-shadow-lg);
    margin-bottom: 2rem;
}

.ff-cover-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 500px;
}

.ff-blog-content {
    font-family: var(--ff-font-story);
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--ff-text-primary);
    margin-bottom: 3rem;
    overflow-wrap: break-word;
    word-wrap: break-word;
    min-width: 0;
}

.ff-blog-content h1,
.ff-blog-content h2,
.ff-blog-content h3,
.ff-blog-content h4 {
    font-family: var(--ff-font-heading);
    color: var(--ff-text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.ff-blog-content p {
    margin-bottom: 1.25rem;
}

.ff-blog-content a {
    color: var(--ff-primary);
    text-decoration: underline;
}

.ff-blog-content img {
    max-width: 100%;
    border-radius: var(--ff-radius-lg);
    margin: 1rem 0;
}

.ff-blog-content ul,
.ff-blog-content ol {
    padding-left: 1.75rem;
    margin-bottom: 1.25rem;
}

.ff-blog-content li {
    margin-bottom: 0.5rem;
}

.ff-blog-content blockquote {
    border-left: 4px solid var(--ff-primary);
    padding: 0.75rem 1.25rem;
    background: rgba(155, 126, 217, 0.06);
    border-radius: 0 var(--ff-radius-md) var(--ff-radius-md) 0;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--ff-text-secondary);
}

.ff-blog-content pre {
    overflow-x: auto;
    background: #f4f1fa;
    border-radius: var(--ff-radius-md);
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.ff-blog-content code {
    background: rgba(155, 126, 217, 0.1);
    color: var(--ff-primary-dark);
    padding: 0.15rem 0.4rem;
    border-radius: var(--ff-radius-sm);
    font-size: 0.9em;
    word-break: break-all;
}

.ff-blog-content pre code {
    background: transparent;
    padding: 0;
    font-size: inherit;
}

.ff-blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ff-blog-content table th,
.ff-blog-content table td {
    padding: 0.65rem 0.9rem;
    border: 1px solid rgba(155, 126, 217, 0.2);
    text-align: left;
    white-space: nowrap;
}

.ff-blog-content table th {
    background: rgba(155, 126, 217, 0.08);
    font-weight: 700;
    color: var(--ff-text-primary);
}

.ff-blog-content table tr:nth-child(even) {
    background: rgba(155, 126, 217, 0.03);
}

.ff-blog-content iframe,
.ff-blog-content embed,
.ff-blog-content video {
    max-width: 100%;
    height: auto;
}

.ff-blog-summary {
    font-family: var(--ff-font-story);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ff-text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
    padding: 1.5rem;
    border-left: 4px solid var(--ff-primary);
    background: rgba(155, 126, 217, 0.06);
    border-radius: 0 var(--ff-radius-md) var(--ff-radius-md) 0;
}

.ff-meta-badge-category {
    background: rgba(249, 168, 117, 0.15);
    color: var(--ff-secondary-dark);
}

/* Tags */
.ff-tags-section {
    margin-bottom: 2.5rem;
}

.ff-tags-label {
    font-weight: 700;
    color: var(--ff-text-primary);
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.ff-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(155, 126, 217, 0.1);
    color: var(--ff-primary);
    border-radius: var(--ff-radius-pill);
    padding: 0.3rem 0.875rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0.25rem 0.25rem 0;
    text-decoration: none;
    transition: var(--ff-transition-base);
    border: 1px solid rgba(155, 126, 217, 0.2);
}

.ff-tag:hover {
    background: var(--ff-gradient-primary);
    color: white;
    border-color: transparent;
}

/* Related Stories Widget */
.ff-related-widget {
    background: white;
    border-radius: var(--ff-radius-2xl);
    padding: 2.5rem;
    box-shadow: var(--ff-shadow-md);
    border: 2px solid rgba(155, 126, 217, 0.1);
    margin-top: 3rem;
}

.ff-related-heading {
    font-family: var(--ff-font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--ff-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.ff-related-subtitle {
    color: var(--ff-text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
}

.ff-story-card {
    background: white;
    border-radius: var(--ff-radius-xl);
    border: 2px solid rgba(155, 126, 217, 0.1);
    overflow: hidden;
    transition: var(--ff-transition-smooth);
    box-shadow: var(--ff-shadow-sm);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ff-story-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ff-shadow-lg);
    border-color: rgba(155, 126, 217, 0.35);
}

.ff-story-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.ff-story-card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ff-story-card-title {
    font-family: var(--ff-font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--ff-text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.ff-story-card-summary {
    font-size: 0.85rem;
    color: var(--ff-text-muted);
    flex: 1;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.ff-story-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.ff-story-card-views {
    font-size: 0.8rem;
    color: var(--ff-text-muted);
}

/* ---------------------------------------------------------------
   PHASE 9 — Task 15: Responsive Fixes
--------------------------------------------------------------- */

@media (max-width: 767.98px) {
    /* Footer */
    .ff-trust-badges {
        justify-content: center;
        margin-top: 0.75rem;
    }

    .ff-copyright {
        text-align: center;
    }

    .ff-footer-bottom .row > div {
        text-align: center;
    }

    /* Story text cards */
    .ff-text-card {
        padding: 1.5rem;
    }

    .ff-story-text {
        font-size: 1.1rem;
    }

    /* Share buttons */
    .ff-share-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .ff-share-btn {
        justify-content: center;
    }

    /* CTA */
    .ff-cta-card {
        padding: 2rem 1.25rem;
    }

    .ff-cta-title {
        font-size: 1.4rem;
    }

    /* Related widget */
    .ff-related-widget {
        padding: 1.5rem;
    }

    /* Blog content mobile */
    .ff-blog-content {
        font-size: 1rem;
    }

    .ff-blog-content h1 { font-size: 1.5rem; }
    .ff-blog-content h2 { font-size: 1.3rem; }
    .ff-blog-content h3 { font-size: 1.15rem; }
    .ff-blog-content h4 { font-size: 1.05rem; }

    .ff-related-heading {
        font-size: 1.35rem;
    }

    .ff-blog-summary {
        font-size: 1rem;
        padding: 1rem 1.125rem;
    }
}

@media (max-width: 575.98px) {
    /* Prevent horizontal overflow */
    .ff-story-pages,
    .ff-share-content {
        padding: 0;
    }

    .ff-text-card {
        padding: 1.25rem;
        border-radius: var(--ff-radius-lg);
    }

    .ff-illustration-card {
        border-radius: var(--ff-radius-lg);
    }

    .ff-story-text {
        font-size: 1rem;
    }

    /* Toast: ensure centered, avoid overflow */
    .ff-toast {
        max-width: calc(100vw - 2rem);
        white-space: normal;
        text-align: center;
        justify-content: center;
    }

    /* Blog content: prevent any child from breaking layout */
    .ff-blog-content {
        overflow-x: hidden;
    }

    .ff-blog-content table th,
    .ff-blog-content table td {
        white-space: normal;
        font-size: 0.85rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    /* Footer: 2-column layout for link columns */
    .ff-footer-links {
        flex: 0 0 50%;
        max-width: 50%;
    }
}
