/**
 * Strict Category Infinite Scroll - Styles
 * Focus: Zero Layout Shift, Smooth Animations, Skeleton Loaders
 */

/* ==================== INFINITE SCROLL CONTAINER ==================== */
.infinite-scroll-section {
    width: 100%;
    max-width: 100%;
    margin-top: 60px;
    display: block;
    min-height: auto;
    box-sizing: border-box;
    overflow-x: hidden;
}

.infinite-scroll-sentinel {
    width: 100%;
    height: 1px;
    pointer-events: none;
}

.infinite-scroll-inline-ad {
    margin: 36px 0;
    padding: 16px 18px 20px;
    border: 1px solid #efefef;
    border-radius: 8px;
    background: #fafafa;
    box-sizing: border-box;
    width: 100%;
}

.infinite-scroll-ad-label {
    margin-bottom: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #8a8a8a;
}

.infinite-scroll-inline-ad .adsbygoogle {
    min-height: 120px;
}

/* ==================== END OF CATEGORY MESSAGE ==================== */
.infinite-scroll-end-message {
    margin: 80px 0;
    text-align: center;
    animation: infiniteScrollEndMessageFade 0.6s ease-in;
}

@keyframes infiniteScrollEndMessageFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.end-message-content {
    padding: 60px 40px;
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    border-radius: 8px;
    border: 1px solid #eee;
    box-sizing: border-box;
    width: 100%;
    margin: 0 auto;
}

.end-message-icon {
    font-size: 48px;
    color: #4caf50;
    display: block;
    margin-bottom: 20px;
}

.end-message-title {
    font-size: 24px;
    font-weight: 700;
    color: #222;
    margin: 0 0 12px 0;
}

.end-message-text {
    font-size: 16px;
    color: #666;
    margin: 12px 0 30px 0;
    line-height: 1.6;
}

.end-message-link {
    color: #f58220;
    font-weight: 700;
    text-decoration: none;
}

.end-message-link:hover {
    text-decoration: underline;
}

.back-to-top-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    background-color: #f58220;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-to-top-btn:hover {
    background-color: #d9471a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 130, 32, 0.3);
}

.back-to-top-btn:active {
    transform: translateY(0);
}

.back-to-top-icon {
    display: inline-block;
    font-size: 16px;
    font-weight: bold;
}

.end-message-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    background-color: #f58220;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.end-message-back-btn:hover {
    background-color: #d9471a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 130, 32, 0.3);
}

@media (max-width: 768px) {
    .infinite-scroll-inline-ad {
        margin: 30px 0;
        padding: 14px 14px 16px;
        width: 100%;
        box-sizing: border-box;
    }

    .end-message-content {
        padding: 40px 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .end-message-icon {
        font-size: 36px;
        margin-bottom: 16px;
    }

    .end-message-title {
        font-size: 20px;
    }

    .end-message-text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .infinite-scroll-section {
        margin-top: 40px;
    }

    .infinite-scroll-inline-ad {
        margin: 24px 0;
        padding: 12px 12px 14px;
        width: 100%;
        box-sizing: border-box;
    }

    .infinite-scroll-ad-label {
        font-size: 10px;
        letter-spacing: 0.5px;
        margin-bottom: 10px;
    }

    .infinite-scroll-inline-ad .adsbygoogle {
        min-height: 100px;
    }

    .infinite-scroll-end-message {
        margin: 60px 0;
    }

    .end-message-content {
        padding: 30px 16px;
        width: 100%;
        box-sizing: border-box;
    }

    .end-message-icon {
        font-size: 32px;
        margin-bottom: 12px;
    }

    .end-message-title {
        font-size: 18px;
        margin: 0 0 10px 0;
    }

    .end-message-text {
        font-size: 13px;
        margin: 10px 0 20px 0;
    }

    .back-to-top-btn,
    .end-message-back-btn {
        padding: 10px 24px;
        font-size: 12px;
        width: 100%;
        justify-content: center;
    }
}

/* ==================== READ NEXT STORY DIVIDER ==================== */
.read-next-story-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.read-next-story-divider .divider-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
}

.read-next-story-divider .divider-text {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #999;
    text-transform: uppercase;
}

.read-next-story-divider .divider-arrow {
    font-size: 16px;
    color: #f58220;
    animation: infiniteScrollArrowBounce 1.5s ease-in-out infinite;
}

@keyframes infiniteScrollArrowBounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(8px);
    }
}

/* ==================== SKELETON LOADER ==================== */
.infinite-scroll-skeleton-loader {
    animation: fadeInSkeleton 0.3s ease-in;
}

@keyframes fadeInSkeleton {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.skeleton-article {
    margin: 40px 0;
    padding: 0;
}

.skeleton-image {
    width: 100%;
    height: 500px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: infiniteScrollSkeleton 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 20px;
}

.skeleton-content {
    padding: 20px 0;
}

.skeleton-title {
    height: 42px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: infiniteScrollSkeleton 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 16px;
}

.skeleton-text {
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: infiniteScrollSkeleton 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-text.short {
    width: 60%;
}

@keyframes infiniteScrollSkeleton {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==================== ARTICLE CONTAINER ==================== */
.infinite-scroll-article-container {
    animation: infiniteScrollFadeIn 0.6s ease-in-out;
    margin-bottom: 0;
}

@keyframes infiniteScrollFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.infinite-scroll-article-wrapper {
    border-top: 1px solid #f5f5f5;
    padding-top: 40px;
}

/* ==================== ARTICLE IMAGE (Reserved Height) ==================== */
.infinite-scroll-article-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 20px;
    display: block;
    animation: infiniteScrollImageFade 0.6s ease-in;
}

@keyframes infiniteScrollImageFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==================== ARTICLE TITLE (Reserved Height) ==================== */
.infinite-scroll-article-title {
    font-size: 35px;
    font-weight: 700;
    line-height: 1.2;
    color: #222222;
    margin: 20px 0 16px 0;
    font-family: "Merriweather", serif;
    animation: infiniteScrollTitleFade 0.6s ease-in 0.1s both;
}

@keyframes infiniteScrollTitleFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== ARTICLE SUBTITLE ==================== */
.infinite-scroll-article-subtitle {
    font-size: 18px;
    font-style: italic;
    line-height: 1.6;
    color: #555555;
    margin: 20px 0;
    padding: 20px;
    background-color: #f9f9f9;
    border-left: 4px solid #f58220;
    border-radius: 2px;
    animation: infiniteScrollSubtitleFade 0.6s ease-in 0.2s both;
}

@keyframes infiniteScrollSubtitleFade {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==================== AUTHOR SECTION ==================== */
.infinite-scroll-author-section {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 20px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin: 20px 0;
    animation: infiniteScrollAuthorFade 0.6s ease-in 0.15s both;
}

@keyframes infiniteScrollAuthorFade {
    from {
        opacity: 0;
        transform: translateX(-15px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #f0f0f0;
    flex-shrink: 0;
}

.author-info {
    flex: 1;
}

.author-name {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    margin: 0;
}

.author-name a {
    color: #222;
    text-decoration: none;
    transition: color 0.3s ease;
}

.author-name a:hover {
    color: #f58220;
}

.author-designation {
    font-size: 13px;
    color: #777;
    margin: 4px 0;
}

.article-publish-date {
    font-size: 13px;
    color: #777;
    margin: 8px 0 0 0;
}

/* ==================== ARTICLE CONTENT ==================== */
.infinite-scroll-article-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333333;
    margin: 30px 0;
    animation: infiniteScrollContentFade 0.6s ease-in 0.25s both;
}

@keyframes infiniteScrollContentFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.infinite-scroll-article-content p {
    margin-bottom: 20px;
}

.infinite-scroll-article-content h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 40px 0 20px 0;
    color: #222;
    font-family: "Merriweather", serif;
}

.infinite-scroll-article-content h3 {
    font-size: 22px;
    font-weight: 700;
    margin: 30px 0 15px 0;
    color: #222;
    font-family: "Merriweather", serif;
}

.infinite-scroll-article-content ul,
.infinite-scroll-article-content ol {
    margin: 20px 0 20px 30px;
}

.infinite-scroll-article-content li {
    margin-bottom: 12px;
}

.infinite-scroll-article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px 0;
    border-radius: 4px;
}

.infinite-scroll-article-content blockquote {
    border-left: 4px solid #f58220;
    padding: 20px;
    margin: 30px 0;
    font-style: italic;
    color: #666;
    background-color: #fafafa;
    border-radius: 2px;
}

.infinite-scroll-article-content code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: "Courier New", monospace;
    word-break: break-word;
}

.infinite-scroll-article-content pre {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 20px 0;
}

/* ==================== ZERO LAYOUT SHIFT CONTAINER ==================== */
.infinite-scroll-article-body {
    /* Reserved height to prevent jumps */
    min-height: auto;
    overflow: hidden;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
    .read-next-story-divider {
        /* margin: 40px 0 30px 0;
        padding: 30px 0; */
        gap: 8px;
    }

    .read-next-story-divider .divider-text {
        font-size: 11px;
        letter-spacing: 1.5px;
    }

    .skeleton-image {
        height: 300px;
    }

    .infinite-scroll-article-title {
        font-size: 32px;
    }

    .infinite-scroll-article-subtitle {
        font-size: 16px;
    }

    .infinite-scroll-article-content {
        font-size: 15px;
    }

    .infinite-scroll-article-wrapper {
        padding-top: 30px;
    }
}

@media (max-width: 480px) {
    .infinite-scroll-inline-ad .adsbygoogle {
        min-height: 100px;
    }

    /* .read-next-story-divider {
        margin: 30px 0 20px 0;
        padding: 20px 0;
    } */

    .read-next-story-divider .divider-text {
        font-size: 10px;
        letter-spacing: 1px;
    }

    .skeleton-image {
        height: 250px;
    }

    .infinite-scroll-article-title {
        font-size: 24px;
        margin: 16px 0 12px 0;
    }

    .infinite-scroll-article-subtitle {
        font-size: 14px;
        padding: 16px;
        margin: 16px 0;
    }

    .infinite-scroll-author-section {
        padding: 16px 0;
        margin: 16px 0;
    }

    .infinite-scroll-article-content {
        font-size: 14px;
        line-height: 1.7;
    }

    .infinite-scroll-article-wrapper {
        padding-top: 20px;
    }
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
    .read-next-story-divider .divider-arrow,
    .infinite-scroll-skeleton-loader,
    .infinite-scroll-article-container,
    .infinite-scroll-article-title,
    .infinite-scroll-article-image,
    .infinite-scroll-author-section,
    .infinite-scroll-article-content {
        animation: none !important;
    }
}

/* ==================== SIDEBAR STICKY POSITIONING ==================== */
@supports (position: sticky) {
    .article-sidebar {
        position: sticky;
        top: 120px;
    }
}

@media (max-width: 480px) {
    .article-sidebar {
        position: static;
        top: auto;
        margin-top: 40px;
    }
}
@media (max-width: 768px) {
    .article-sidebar {
        position: static;
        top: auto;
        margin-top: 40px;
    }
}
@media (max-width: 1024px) {
    .article-sidebar {
        position: static;
        top: auto;
        margin-top: 40px;
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .read-next-story-divider,
    .infinite-scroll-skeleton-loader {
        display: none;
    }
}
