/* ========================================
 * HOMEPAGE HERO - 3 column layout (replaces old Editor's Picks)
 * ======================================== */

/* Widen the container on the homepage only (hero, popular this week, latest
   reviews) to cut down the side whitespace on large screens, keeping their
   left/right edges aligned with each other. Every other page keeps the
   site-wide 1200px container. */
body.front-page .homepage-hero-section .container,
body.front-page .popular-week-section .container,
body.front-page .subcat-showcase-section .container,
body.front-page .posts-section .container {
    max-width: var(--container-2xl);
}

/* ========================================
 * SUBCATEGORY SHOWCASE - one box per subcategory, reuses .featured-card
 * (same markup/styling as Editor's Picks) for the big-left/small-right cards.
 * ======================================== */

.subcat-showcase-section {
    padding: var(--space-12) 0;
    background-color: var(--color-bg);
}

.subcat-showcase-box {
    margin-bottom: var(--space-10);
}

.subcat-showcase-box:last-child {
    margin-bottom: 0;
}

.subcat-showcase-box__title {
    display: inline-block;
    margin: 0 0 var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 3px solid var(--color-primary);
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
}

.subcat-showcase-box__title a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text);
    text-decoration: none;
}

.subcat-showcase-box__title a:hover {
    color: var(--color-primary);
}

.subcat-showcase-box__icon {
    width: 0.75em;
    height: 0.75em;
    flex-shrink: 0;
    color: #DC2626;
}

.subcat-showcase-box__icon--bi {
    width: auto;
    height: auto;
    font-size: 0.75em;
}

/* Wirecutter-style grid: no card frame/border on either side, just image + title */

.wc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
}

@media (min-width: 1024px) {
    .wc-grid {
        grid-template-columns: 1.4fr 1fr;
        gap: var(--space-10);
    }
}

/* Left: big post, image on top, plain title below */

.wc-main__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.wc-main__image {
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.wc-main__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.wc-main__title {
    margin: var(--space-4) 0 0;
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--color-text);
}

.wc-main__link:hover .wc-main__title {
    color: var(--color-primary);
}

.wc-main__excerpt {
    margin: var(--space-2) 0 0;
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary, var(--color-text-muted));
}

/* Right: small thumbnail beside the title on top, excerpt spans the full
   width underneath (image + title combined), stacked list, no dividers */

.wc-side-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.wc-side-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    text-decoration: none;
    color: inherit;
}

.wc-side-item__top {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
}

.wc-side-item__image {
    flex: 0 0 128px;
    width: 128px;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.wc-side-item__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.wc-side-item__title {
    margin: 0;
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    line-height: var(--leading-snug);
    color: var(--color-text);
}

.wc-side-item:hover .wc-side-item__title {
    color: var(--color-primary);
}

.wc-side-item__excerpt {
    margin: 0;
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary, var(--color-text-muted));
}

.wc-main__meta,
.wc-side-item__meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-2);
}

.wc-main__meta-item,
.wc-side-item__meta-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.wc-main__meta-item i,
.wc-side-item__meta-item i {
    font-size: 0.9em;
}

.homepage-hero-section {
    padding: var(--space-12) 0;
    background-color: var(--color-bg);
}

.homepage-hero {
    display: grid;
    gap: var(--space-8);
    grid-template-columns: 1fr;
    grid-template-areas:
        "middle"
        "latest"
        "deals";
}

@media (min-width: 1024px) {
    .homepage-hero {
        grid-template-columns: 220px minmax(0, 1fr) 280px;
        grid-template-areas: "latest middle deals";
        gap: var(--space-6);
        align-items: start;
    }
}

.hero-col-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin: 0 0 var(--space-4);
}

.hero-col-title__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-primary-light) 0%, rgba(244, 165, 138, 0.1) 100%);
    border-radius: var(--radius-lg);
    color: var(--color-primary);
}

.hero-col-title__icon i {
    font-size: 20px;
}

.hero-col-title__text {
    display: inline-block;
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
    position: relative;
    padding-bottom: var(--space-1-5);
}

.hero-col-title__text::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background-color: var(--color-primary);
    border-radius: var(--radius-full);
}

/* ---- LEFT: The Latest ---- */

.homepage-hero__latest {
    grid-area: latest;
}

.hero-latest-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.hero-latest-list__item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
}

.hero-latest-list__item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.hero-latest-list__title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    text-decoration: none;
    line-height: var(--leading-snug, 1.35);
}

.hero-latest-list__title:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.hero-latest-list__date {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* ---- MIDDLE: Featured sticky posts ---- */

.homepage-hero__middle {
    grid-area: middle;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.homepage-hero__middle-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 640px) {
    .homepage-hero__middle-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ---- RIGHT: Best Deals ---- */

.homepage-hero__deals {
    grid-area: deals;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.hero-deals-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-3) var(--space-5);
    background-color: #DC2626;
    background-image: linear-gradient(180deg, #EF4444 0%, #DC2626 100%);
    color: #FFFFFF;
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide, 0.02em);
    text-decoration: none;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 0 #991B1B, var(--shadow-md);
    transition: transform var(--duration-150, 0.15s) var(--ease-out),
                box-shadow var(--duration-150, 0.15s) var(--ease-out);
}

.hero-deals-cta:hover {
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #991B1B, 0 8px 20px rgba(220, 38, 38, 0.35);
}

.hero-deals-cta:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #991B1B;
}

.hero-deals-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.hero-deal-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
}

.hero-deal-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.hero-deal-card__image {
    position: relative;
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
}

.hero-deal-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hero-deal-card__badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background-color: #DC2626;
    color: #FFFFFF;
    font-size: 10px;
    font-weight: var(--font-bold);
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    z-index: 1;
}

.hero-deal-card__info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.hero-deal-card__title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-deal-card__price {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.hero-deal-card__price del {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-muted);
}

.hero-deals-viewall,
.hero-latest-viewall {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-primary);
    text-decoration: none;
    padding-top: var(--space-2);
}

.hero-deals-viewall:hover,
.hero-latest-viewall:hover {
    text-decoration: underline;
}

[data-theme="dark"] .hero-latest-list__item,
[data-theme="dark"] .hero-deal-card {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .hero-deal-card__image {
    background-color: var(--color-surface-raised);
    border-color: rgba(255, 255, 255, 0.08);
}

/* ========================================
 * POPULAR THIS WEEK
 * ======================================== */

.popular-week-section {
    padding: var(--space-10) 0;
    background-color: var(--color-bg-alt);
}

.popular-week-section .homepage-section-title {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
}

.popular-week-section .homepage-section-title .bi-fire {
    color: #DC2626;
}

.popular-week-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-2);
}

@media (min-width: 480px) {
    .popular-week-row {
        gap: var(--space-3);
    }
}

@media (min-width: 1024px) {
    .popular-week-row {
        gap: var(--space-5);
    }
}

.popular-week-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-1-5);
    min-width: 0;
}

@media (min-width: 1024px) {
    .popular-week-card {
        gap: var(--space-2);
    }
}

.popular-week-card__link {
    display: flex;
    flex-direction: column;
    gap: var(--space-1-5);
    text-decoration: none;
    position: relative;
}

@media (min-width: 1024px) {
    .popular-week-card__link {
        gap: var(--space-3);
    }
}

.popular-week-card__rank {
    align-self: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: #FFFFFF;
    font-size: 10px;
    font-weight: var(--font-bold);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

@media (min-width: 1024px) {
    .popular-week-card__rank {
        font-size: var(--text-sm);
        padding: 4px 12px;
    }
}

.popular-week-card__image {
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
}

@media (min-width: 1024px) {
    .popular-week-card__image {
        border-radius: var(--radius-lg);
    }
}

.popular-week-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-300, 0.3s) var(--ease-out);
}

.popular-week-card__link:hover .popular-week-card__img {
    transform: scale(1.05);
}

.popular-week-card__title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    line-height: var(--leading-snug, 1.35);
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (min-width: 640px) {
    .popular-week-card__title {
        font-size: var(--text-sm);
    }
}

@media (min-width: 1024px) {
    .popular-week-card__title {
        font-size: var(--text-lg);
        font-weight: var(--font-bold);
    }
}

.popular-week-card__link:hover .popular-week-card__title {
    color: var(--color-primary);
}

.popular-week-card__meta {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 11px;
}

@media (min-width: 1024px) {
    .popular-week-card__meta {
        font-size: var(--text-sm);
    }
}

.popular-week-card__category {
    color: var(--color-primary);
    font-weight: var(--font-semibold);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.popular-week-card__category:hover {
    text-decoration: underline;
}
