/*
Theme Name: The Viral Story
Theme URI: https://theviralstory.com/
Author: CY Team
Author URI: https://theviralstory.com/
Description: Clean magazine-style WordPress theme for The Viral Story. 30 posts per page, automatic pagination, 3-column responsive grid, 16:9 featured images, compact two-line titles, and no advertisement placeholders.
Version: 1.0.0
License: GPL-2.0-or-later
Text Domain: the-viral-story
*/

:root {
    --tvs-navy: #071d2a;
    --tvs-navy-2: #0d2d3b;
    --tvs-blue: #1769e0;
    --tvs-blue-dark: #0e4fb8;
    --tvs-text: #111827;
    --tvs-muted: #707780;
    --tvs-border: #e5e7eb;
    --tvs-bg: #ffffff;
    --tvs-soft: #f6f8fa;
    --tvs-container: 1320px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--tvs-bg);
    color: var(--tvs-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font: inherit;
}

/* Header */
.tvs-site-header {
    background: #fff;
}

.tvs-topbar {
    border-bottom: 1px solid var(--tvs-border);
}

.tvs-header-inner {
    width: min(100% - 40px, var(--tvs-container));
    margin: 0 auto;
    min-height: 104px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.tvs-brand {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    min-width: 0;
}

.tvs-brand-mark {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #3287ff 0%, #1769e0 45%, #073c9a 100%);
    color: #fff;
    font-size: 25px;
    font-weight: 900;
    letter-spacing: -1px;
    box-shadow: 0 7px 15px rgba(23, 105, 224, .28), inset 0 1px 0 rgba(255,255,255,.45);
    transform: perspective(500px) rotateX(2deg);
}

.tvs-brand-text {
    min-width: 0;
}

.tvs-brand-name {
    display: block;
    color: var(--tvs-navy);
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1;
    font-weight: 900;
    letter-spacing: -1.3px;
}

.tvs-brand-tagline {
    display: block;
    margin-top: 7px;
    color: var(--tvs-muted);
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: .4px;
}

.tvs-menu-toggle {
    display: none;
    border: 0;
    background: var(--tvs-navy);
    color: #fff;
    border-radius: 7px;
    padding: 10px 13px;
    cursor: pointer;
}

.tvs-nav-wrap {
    background: var(--tvs-navy);
}

.tvs-nav-inner {
    width: min(100% - 40px, var(--tvs-container));
    margin: 0 auto;
}

.tvs-primary-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
}

.tvs-primary-menu li {
    margin: 0;
    padding: 0;
}

.tvs-primary-menu a {
    display: block;
    padding: 15px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
    transition: background .2s ease, color .2s ease;
}

.tvs-primary-menu a:hover,
.tvs-primary-menu .current-menu-item > a,
.tvs-primary-menu .current_page_item > a {
    background: var(--tvs-blue);
    color: #fff;
}

/* Main */
.tvs-main {
    min-height: 50vh;
}

.tvs-container {
    width: min(100% - 40px, var(--tvs-container));
    margin: 0 auto;
    padding: 42px 0 70px;
}

.tvs-page-heading {
    margin: 0 0 30px;
    padding: 0;
    color: var(--tvs-navy);
    font-size: clamp(28px, 3vw, 36px);
    line-height: 1.15;
    font-weight: 850;
    letter-spacing: -.8px;
}

.tvs-page-heading::after {
    content: "";
    display: block;
    width: 54px;
    height: 4px;
    margin-top: 12px;
    background: var(--tvs-blue);
    border-radius: 3px;
}

/* Post grid */
.tvs-post-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 52px 30px;
}

.tvs-post {
    min-width: 0;
    margin: 0;
    padding: 0;
}

.tvs-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #eef1f4;
    margin: 0 0 16px;
    text-decoration: none;
}

.tvs-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .28s ease;
}

.tvs-thumb:hover img {
    transform: scale(1.035);
}

.tvs-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #89919a;
    background: linear-gradient(135deg, #eef2f5, #dfe5ea);
    font-weight: 700;
}

.tvs-category {
    margin: 0 0 7px;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 750;
}

.tvs-category a {
    color: var(--tvs-blue);
    text-decoration: none;
}

.tvs-category a:hover {
    text-decoration: underline;
}

.tvs-post-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    height: 3.15em;
    max-height: 3.15em;
    margin: 0 0 10px;
    padding: 0;
    color: var(--tvs-text);
    font-size: 22px;
    line-height: 1.575;
    font-weight: 800;
    letter-spacing: -.35px;
}

.tvs-post-title a {
    text-decoration: none;
}

.tvs-post-title a:hover {
    color: var(--tvs-blue);
}

.tvs-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-height: 22px;
    margin: 0;
    color: var(--tvs-muted);
    font-size: 12px;
    line-height: 1.5;
}

.tvs-meta-separator {
    margin: 0 7px;
}

/* Pagination */
.tvs-pagination {
    margin: 62px 0 0;
}

.tvs-pagination .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.tvs-pagination .page-numbers {
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d9dee4;
    background: #fff;
    color: var(--tvs-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 750;
    line-height: 1;
    transition: .2s ease;
}

.tvs-pagination .page-numbers:hover,
.tvs-pagination .page-numbers.current {
    border-color: var(--tvs-blue);
    background: var(--tvs-blue);
    color: #fff;
}

.tvs-pagination .page-numbers.prev,
.tvs-pagination .page-numbers.next {
    padding-left: 17px;
    padding-right: 17px;
}

/* Single */
.tvs-single {
    max-width: 920px;
    margin: 0 auto;
}

.tvs-single-category {
    margin-bottom: 8px;
    color: var(--tvs-blue);
    font-size: 14px;
    font-weight: 750;
}

.tvs-single-title {
    margin: 0 0 14px;
    color: var(--tvs-navy);
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.08;
    letter-spacing: -1.5px;
    font-weight: 900;
}

.tvs-single-meta {
    margin-bottom: 30px;
    color: var(--tvs-muted);
    font-size: 13px;
}

.tvs-single-featured {
    margin: 0 0 32px;
}

.tvs-single-featured img {
    display: block;
    width: 100%;
    height: auto;
}

.tvs-entry-content {
    font-size: 18px;
    line-height: 1.85;
}

.tvs-entry-content > * {
    margin-top: 0;
    margin-bottom: 1.35em;
}

.tvs-entry-content h2,
.tvs-entry-content h3 {
    color: var(--tvs-navy);
    line-height: 1.25;
}

.tvs-entry-content img {
    height: auto;
}

.tvs-entry-content a {
    color: var(--tvs-blue);
}

/* Search / archives */
.tvs-search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 35px;
}

.tvs-search-form input[type="search"] {
    width: 100%;
    border: 1px solid #d9dee4;
    padding: 12px 14px;
}

.tvs-search-form button {
    border: 0;
    padding: 0 18px;
    background: var(--tvs-blue);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.tvs-no-posts {
    padding: 40px 0;
    color: var(--tvs-muted);
}

/* Footer */
.tvs-footer {
    background: var(--tvs-navy);
    color: #d9e1e7;
    margin-top: 0;
}

.tvs-footer-inner {
    width: min(100% - 40px, var(--tvs-container));
    margin: 0 auto;
    padding: 35px 0;
    text-align: center;
}

.tvs-footer-brand {
    margin: 0 0 7px;
    color: #fff;
    font-size: 20px;
    font-weight: 850;
}

.tvs-footer-copy {
    margin: 0;
    color: #aebbc4;
    font-size: 12px;
}

/* WordPress accessibility */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}

/* Tablet */
@media (max-width: 980px) {
    .tvs-post-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 44px 24px;
    }

    .tvs-header-inner {
        min-height: 90px;
    }

    .tvs-post-title {
        font-size: 21px;
        line-height: 1.5;
        height: 3em;
        max-height: 3em;
    }
}

/* Mobile */
@media (max-width: 700px) {
    .tvs-header-inner,
    .tvs-nav-inner,
    .tvs-container,
    .tvs-footer-inner {
        width: min(100% - 28px, var(--tvs-container));
    }

    .tvs-header-inner {
        min-height: 76px;
    }

    .tvs-brand-mark {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        border-radius: 11px;
        font-size: 20px;
    }

    .tvs-brand-name {
        font-size: 24px;
    }

    .tvs-brand-tagline {
        display: none;
    }

    .tvs-menu-toggle {
        display: block;
    }

    .tvs-nav-wrap {
        display: none;
    }

    .tvs-nav-wrap.is-open {
        display: block;
    }

    .tvs-primary-menu {
        display: block;
    }

    .tvs-primary-menu a {
        padding: 14px 10px;
        border-top: 1px solid rgba(255,255,255,.08);
    }

    .tvs-container {
        padding: 30px 0 55px;
    }

    .tvs-page-heading {
        margin-bottom: 24px;
        font-size: 28px;
    }

    .tvs-post-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .tvs-post-title {
        font-size: 21px;
        line-height: 1.45;
        height: 2.9em;
        max-height: 2.9em;
    }

    .tvs-single-title {
        font-size: 34px;
        letter-spacing: -.8px;
    }

    .tvs-entry-content {
        font-size: 17px;
        line-height: 1.75;
    }

    .tvs-pagination {
        margin-top: 45px;
    }

    .tvs-pagination .nav-links {
        gap: 6px;
    }

    .tvs-pagination .page-numbers {
        min-width: 38px;
        height: 38px;
        padding: 0 9px;
    }
}

@media (max-width: 380px) {
    .tvs-brand-name {
        font-size: 21px;
    }

    .tvs-post-title {
        font-size: 20px;
    }
}
