/* Homepage */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.home-page {
    background:
        radial-gradient(ellipse 90% 60% at 50% -20%, rgba(79, 70, 229, 0.08), transparent 70%),
        var(--background);
}

/* Hero */

.home-hero {
    margin-top: calc(-1 * var(--navbar-height));
    padding: calc(var(--navbar-height) + 3.25rem) 1.25rem 3.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background:
        linear-gradient(180deg, rgba(99, 102, 241, 0.04) 0%, transparent 100%),
        var(--background);
}

.home-hero-inner {
    max-width: 720px;
    margin: 0 auto;
}

.home-hero h1 {
    font-size: clamp(2rem, 4.5vw, 2.85rem);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-color);
    margin: 0 0 0.9rem;
}

.home-hero-lead {
    font-size: clamp(1rem, 2vw, 1.12rem);
    color: var(--light-text);
    max-width: 34rem;
    margin: 0 auto 1.75rem;
    line-height: 1.65;
}

.home-hero-search {
    display: flex;
    align-items: center;
    max-width: 480px;
    margin: 0 auto 1.35rem;
    border: 1px solid var(--border-color);
    background: var(--card-background);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-hero-search:focus-within {
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 6px 28px rgba(79, 70, 229, 0.12);
}

.home-hero-search-icon {
    margin-left: 1rem;
    color: var(--light-text);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.home-hero-search input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 0.9rem 0.75rem;
    font-size: 0.98rem;
    color: var(--text-color);
    min-width: 0;
}

.home-hero-search input:focus {
    outline: none;
}

.home-hero-search button {
    border: 0;
    background: var(--primary-color);
    color: #fff;
    padding: 0.9rem 1.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s ease;
}

.home-hero-search button:hover {
    background: var(--primary-color-dark, #4338ca);
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
}

.home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.home-btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.home-btn-primary:hover {
    background: var(--primary-color-dark, #4338ca);
    color: #fff;
    transform: translateY(-1px);
}

.home-btn-ghost {
    border: 1px solid var(--border-color);
    background: var(--card-background);
    color: var(--text-color);
}

.home-btn-ghost:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Main content */

.home-main {
    max-width: 1140px;
    margin: 0 auto;
    padding: 2.75rem 1.25rem 4rem;
}

.home-section {
    margin-bottom: 3.25rem;
}

.home-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.home-section-head h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-color);
    margin: 0;
}

.home-section-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.home-section-link:hover {
    text-decoration: underline;
}

/* Post grids */

.home-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.35rem;
    align-items: stretch;
}

.home-posts-grid--featured {
    gap: 1.5rem;
}

/* Cards */

.home-post-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.home-post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
}

.home-post-card-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.home-post-card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--light-background);
    flex-shrink: 0;
}

.home-post-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.home-post-card:hover .home-post-card-media img {
    transform: scale(1.03);
}

.home-post-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.1rem 1.15rem 1.2rem;
}

.home-post-card-category {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 0.45rem;
}

.home-post-card-body h3 {
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-color);
    margin: 0 0 0.45rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-post-card-body p {
    margin: 0 0 0.75rem;
    color: var(--light-text);
    font-size: 0.9rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.home-post-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    font-size: 0.78rem;
    color: var(--light-text);
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.home-post-card-meta span:not(:last-child)::after {
    content: '·';
    margin-left: 0.75rem;
    color: var(--border-color);
}

.home-post-card-stats {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding-top: 0.7rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.card-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--light-text);
    line-height: 1;
}

.card-stat i {
    font-size: 0.7rem;
    opacity: 0.9;
}

.card-stat--reactions i { color: #f43f5e; }
.card-stat--comments i { color: #38bdf8; }
.card-stat--views i { color: var(--light-text); opacity: 0.75; }

.card-stat span {
    font-variant-numeric: tabular-nums;
}

.home-post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1.15rem 1rem;
    font-size: 0.78rem;
    color: var(--light-text);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.home-post-card-footer .blog-card-date {
    flex-shrink: 0;
}

.home-post-card-footer .blog-card-authors {
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-post-card-footer .blog-card-author-link,
.home-post-card-footer .blog-card-coauthors a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.home-post-card-footer .blog-card-author-link:hover,
.home-post-card-footer .blog-card-coauthors a:hover {
    text-decoration: underline;
}

.home-post-card-footer .blog-card-coauthors {
    color: var(--light-text);
    font-weight: 400;
}

/* Skeleton loading */

.home-skeleton-card {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--card-background);
}

.home-skeleton-media {
    aspect-ratio: 16 / 10;
    background: linear-gradient(
        90deg,
        var(--light-background) 0%,
        rgba(148, 163, 184, 0.12) 50%,
        var(--light-background) 100%
    );
    background-size: 200% 100%;
    animation: homeShimmer 1.5s ease-in-out infinite;
}

.home-skeleton-body {
    padding: 1.1rem 1.15rem;
}

.home-skeleton-line {
    height: 0.7rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    background: linear-gradient(
        90deg,
        var(--light-background) 0%,
        rgba(148, 163, 184, 0.12) 50%,
        var(--light-background) 100%
    );
    background-size: 200% 100%;
    animation: homeShimmer 1.5s ease-in-out infinite;
}

.home-skeleton-line.w-80 { width: 80%; }
.home-skeleton-line.w-60 { width: 60%; }

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

/* Empty state */

.home-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem 1rem;
    border-radius: 14px;
    border: 1px dashed var(--border-color);
    color: var(--light-text);
    font-size: 0.95rem;
}

/* Responsive */

@media (max-width: 960px) {
    .home-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .home-hero {
        padding-bottom: 2.5rem;
    }

    .home-posts-grid {
        grid-template-columns: 1fr;
    }

    .home-hero-search {
        flex-wrap: wrap;
        border-radius: 12px;
    }

    .home-hero-search-icon {
        display: none;
    }

    .home-hero-search input {
        width: 100%;
        padding-left: 1rem;
    }

    .home-hero-search button {
        width: 100%;
        border-radius: 0;
    }
}
