/**
 * Home page layout
 *
 * The hero extends the shared .page-hero from theme.css. The sections under
 * it (template-parts/home/) build on the components in style.css: section,
 * section-header, card, icon-chip, buttons and link-arrow. Patterns shared
 * with the About and Start Here pages (highlights, steps, facts, reviews)
 * are repeated here under home- names because those stylesheets do not
 * load on the front page. Mobile first, breakpoints at 480, 768 and 1024.
 *
 * @package CustomMobileCarts
 */

.home-hero {
    padding-top: clamp(4rem, 2.5rem + 6vw, 8.5rem);
    padding-bottom: clamp(4rem, 2.5rem + 6vw, 8.5rem);
}

.home-hero__content {
    max-width: 44rem;
}

/* The one place on the site that uses the largest heading size */
.home-hero__title {
    max-width: 16ch;
    font-size: var(--font-size-6xl);
    line-height: 1.04;
    letter-spacing: -0.02em;
}

.home-hero .page-hero__lead {
    max-width: 36rem;
    font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.3125rem);
}

/* ==========================================================================
   Shared: the "see more" line under a section's grid
   ========================================================================== */

.home-section__more,
.home-paths__more {
    margin: var(--spacing-xl) 0 0;
    text-align: center;
}

/* ==========================================================================
   Trust strip: a slim band right under the hero
   ========================================================================== */

.home-trust {
    padding-block: var(--spacing-lg);
    background-color: var(--color-bg-light);
    border-bottom: 1px solid var(--color-border);
}

.home-trust__list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-md) var(--spacing-xl);
}

@media (min-width: 480px) {
    .home-trust__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .home-trust {
        padding-block: var(--spacing-xl);
    }

    .home-trust__list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.home-trust__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.home-trust__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    color: var(--color-chip-fg);
    background-color: var(--color-chip-bg);
    border-radius: var(--radius-md);
}

.home-trust__text {
    font-family: var(--font-heading);
    font-size: 0.9375rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1.35;
    color: var(--color-heading);
}

/* ==========================================================================
   Paths: three cards, one button each
   ========================================================================== */

.home-paths__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-lg);
}

@media (min-width: 768px) {
    .home-paths__grid {
        gap: var(--spacing-xl);
    }
}

@media (min-width: 1024px) {
    .home-paths__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: stretch;
    }
}

.home-path {
    height: 100%;
}

/* Details, not links: the card stays still under the pointer */
@media (hover: hover) {
    .home-path:hover {
        transform: none;
        box-shadow: var(--shadow-xs);
    }
}

.home-path__number {
    margin-bottom: var(--spacing-lg);
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: var(--font-weight-bold);
    line-height: 1.3;
    letter-spacing: var(--letter-spacing-eyebrow);
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    color: var(--color-eyebrow);
}

.home-path__title {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-2xl);
}

.home-path__text {
    margin-bottom: var(--spacing-lg);
    color: var(--color-text-light);
}

/* The button sits on the card's bottom edge whatever the text length */
.home-path > .home-path__btn {
    align-self: stretch;
    margin-top: auto;
}

/* ==========================================================================
   Shop sections: categories, best sellers, recent, on sale, featured
   --------------------------------------------------------------------------
   All five share template-parts/home/shop-section.php. The product cards,
   sale badges and add to cart buttons inside them are WooCommerce markup
   styled once for the whole site in woocommerce.css, so only the layout
   that belongs to the homepage lives here: the body spacing, the category
   tiles (which WooCommerce prints as plain list items) and the view all
   link under each grid.
   ========================================================================== */

.home-shop__body {
    margin: 0;
}

/* The shortcode wraps its list in div.woocommerce, which carries no
   spacing of its own here */
.home-shop__body > .woocommerce {
    margin: 0;
}

.home-shop__more {
    margin-top: var(--spacing-xl);
}

/* Categories: a list of category links, laid out as linked cards.
   Selectors lean on the section key and body wrapper so they outweigh
   the general ul.products rules whichever stylesheet loads last. */
.home-shop--categories .home-shop__body ul.products.columns-3 {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-lg);
    margin: 0;
    padding: 0;
    list-style: none;
    clear: none;
}

/* WooCommerce's clearfix pseudo elements would otherwise take grid cells */
.home-shop--categories .home-shop__body ul.products.columns-3::before,
.home-shop--categories .home-shop__body ul.products.columns-3::after {
    content: none;
    display: none;
}

@media (min-width: 480px) {
    .home-shop--categories .home-shop__body ul.products.columns-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .home-shop--categories .home-shop__body ul.products.columns-3 {
        gap: var(--spacing-xl);
    }
}

@media (min-width: 1024px) {
    .home-shop--categories .home-shop__body ul.products.columns-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.home-shop--categories .home-shop__body ul.products.columns-3 li.product-category {
    position: relative;
    display: flex;
    flex-direction: column;
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    text-align: left;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition:
        transform var(--transition-base),
        box-shadow var(--transition-base),
        border-color var(--transition-base);
}

/* The lift and border change match .card--link */
@media (hover: hover) {
    .home-shop--categories .home-shop__body ul.products.columns-3 li.product-category:hover {
        transform: translateY(-2px);
        border-color: var(--color-primary-30);
        box-shadow: var(--shadow-lg);
    }
}

.home-shop--categories .home-shop__body ul.products.columns-3 li.product-category:focus-within {
    box-shadow: var(--focus-ring);
}

/* The whole tile is one link: image on top, name and count below */
.home-shop--categories .home-shop__body ul.products.columns-3 li.product-category > a {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    color: var(--color-text);
    text-decoration: none;
}

.home-shop--categories .home-shop__body ul.products.columns-3 li.product-category > a:focus-visible {
    outline: none;
    box-shadow: none;
}

.home-shop--categories .home-shop__body ul.products.columns-3 li.product-category img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    margin: 0;
    object-fit: cover;
    background-color: var(--color-bg-light);
    transition: transform var(--transition-slow);
}

@media (hover: hover) {
    .home-shop--categories .home-shop__body ul.products.columns-3 li.product-category:hover img {
        transform: scale(1.03);
    }
}

/* Name and count sit on one line in the heading face. WooCommerce wraps
   the count in <mark>, which browsers would otherwise paint yellow. */
.home-shop--categories .home-shop__body ul.products.columns-3 li.product-category .woocommerce-loop-category__title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.5rem;
    margin: 0;
    padding: var(--spacing-md) var(--spacing-lg) var(--spacing-lg);
    font-family: var(--font-heading);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
    letter-spacing: var(--letter-spacing-heading);
    text-align: left;
    color: var(--color-heading);
    transition: color var(--transition-fast);
}

@media (hover: hover) {
    .home-shop--categories .home-shop__body ul.products.columns-3 li.product-category:hover .woocommerce-loop-category__title {
        color: var(--color-link);
    }
}

.home-shop--categories .home-shop__body ul.products.columns-3 li.product-category .woocommerce-loop-category__title .count {
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
    background: none;
}

/* ==========================================================================
   What we build: white cards on the forest band
   ========================================================================== */

.home-builds__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-lg);
}

@media (min-width: 768px) {
    .home-builds__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-xl);
    }
}

@media (min-width: 1024px) {
    .home-builds__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Cards in a row share one height so their links line up */
.home-builds__grid > li {
    display: flex;
}

.home-build {
    width: 100%;
}

/* ==========================================================================
   How it works: numbered steps beside a sticky heading
   ========================================================================== */

.home-process__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-2xl);
}

@media (min-width: 1024px) {
    .home-process__inner {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        column-gap: var(--spacing-3xl);
        align-items: start;
    }

    .home-process__inner .section-header {
        position: sticky;
        top: calc(var(--header-height) + var(--spacing-xl));
        margin-bottom: 0;
    }
}

.home-steps {
    display: grid;
}

.home-step {
    position: relative;
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr);
    column-gap: var(--spacing-lg);
    padding-bottom: var(--spacing-xl);
}

.home-step:last-child {
    padding-bottom: 0;
}

.home-step:not(:last-child)::before {
    content: '';
    position: absolute;
    top: 3rem;
    bottom: 0.5rem;
    left: calc(1.25rem - 1px);
    width: 2px;
    background-color: var(--color-border);
}

.home-step__marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    font-family: var(--font-heading);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    font-variant-numeric: tabular-nums;
    color: var(--color-text-white);
    background-color: var(--color-primary);
    border-radius: var(--radius-full);
}

.home-step__body {
    padding-top: 0.375rem;
}

.home-step__title {
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-xl);
    letter-spacing: -0.01em;
}

.home-step__text {
    margin: 0;
    color: var(--color-text-light);
}

.home-step__link {
    margin-top: 0.625rem;
}

/* ==========================================================================
   Facts band
   ========================================================================== */

.home-facts {
    padding-block: var(--spacing-3xl);
    border-block: 1px solid var(--color-border);
}

.home-facts__inner {
    display: grid;
    gap: var(--spacing-xl);
}

.home-facts__title {
    max-width: 18ch;
    margin: 0;
    font-size: var(--font-size-2xl);
}

@media (min-width: 1024px) {
    .home-facts__inner {
        grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
        column-gap: var(--spacing-3xl);
        align-items: center;
    }
}

.home-facts__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-lg);
}

@media (min-width: 768px) {
    .home-facts__list {
        grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    }
}

/* The value reads first, the label stays first for screen readers */
.home-fact {
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: var(--spacing-xs);
    padding-left: var(--spacing-md);
    border-left: 2px solid var(--color-secondary);
}

.home-fact__value {
    font-family: var(--font-heading);
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    line-height: 1.1;
    letter-spacing: var(--letter-spacing-heading);
    font-variant-numeric: tabular-nums;
    color: var(--color-heading);
}

.home-fact__label {
    font-size: var(--font-size-sm);
    line-height: 1.4;
    color: var(--color-text-light);
}

/* ==========================================================================
   Reviews: three cards in a row
   ========================================================================== */

.home-reviews__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-lg);
}

@media (min-width: 768px) {
    .home-reviews__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-xl);
    }

    /* An odd third card would sit alone on its own row */
    .home-reviews__grid > li:nth-child(3):last-child {
        grid-column: 1 / -1;
        max-width: calc(50% - var(--spacing-xl) / 2);
        justify-self: center;
        width: 100%;
    }
}

@media (min-width: 1024px) {
    .home-reviews__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .home-reviews__grid > li:nth-child(3):last-child {
        grid-column: auto;
        max-width: none;
    }
}

.home-review {
    gap: 0;
}

/* Reviews are not links, so the card stays put under the pointer */
@media (hover: hover) {
    .home-review:hover {
        transform: none;
        box-shadow: var(--shadow-xs);
    }
}

.home-review__head {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.home-review__avatar {
    flex: none;
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius-full);
    background-color: var(--color-bg-light);
}

.home-review__who {
    min-width: 0;
}

.home-review__name {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    line-height: 1.3;
    color: var(--color-heading);
}

.home-review__meta {
    margin: 0.125rem 0 0;
    font-size: var(--font-size-sm);
    line-height: 1.4;
    color: var(--color-text-muted);
}

.home-review__stars {
    margin-bottom: var(--spacing-md);
}

/* Gold rather than brass so the stars keep 3:1 against the white card */
.home-review__stars-row {
    display: inline-flex;
    gap: 0.125rem;
    color: var(--color-secondary);
}

.home-review__star {
    display: inline-flex;
}

/* Given stars are solid, the rest stay as outlines */
.home-review__star svg {
    fill: currentColor;
}

.home-review__star--empty {
    color: var(--palette-text-400);
}

.home-review__star--empty svg {
    fill: none;
}

.home-review__quote {
    margin: 0;
    padding: 0;
    border: 0;
}

.home-review__quote p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--color-text);
}

.home-review__date {
    margin: var(--spacing-md) 0 0;
    padding-top: var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border-light);
}

/* ==========================================================================
   Journal: the shared article card, whose styles live in blog.css and are
   not loaded on the front page, so the pieces it needs are repeated here
   ========================================================================== */

.home-journal__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-lg);
}

@media (min-width: 768px) {
    .home-journal__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-xl);
    }

    .home-journal__grid > .post-card:nth-child(3):last-child {
        grid-column: 1 / -1;
        max-width: calc(50% - var(--spacing-xl) / 2);
        justify-self: center;
        width: 100%;
    }
}

@media (min-width: 1024px) {
    .home-journal__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .home-journal__grid > .post-card:nth-child(3):last-child {
        grid-column: auto;
        max-width: none;
    }
}

.home-journal .post-card .card__media img {
    transition: transform var(--transition-slow);
}

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

.home-journal .post-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 10;
    color: var(--color-primary);
    background-color: var(--color-bg-tint);
}

.home-journal .post-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.home-journal .post-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.home-journal .post-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0;
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--color-text-light);
}

.home-journal .post-meta__item {
    display: inline-flex;
    align-items: center;
}

.home-journal .post-meta__item + .post-meta__item::before {
    content: '';
    flex: none;
    width: 3px;
    height: 3px;
    margin-inline: 0.625rem;
    border-radius: var(--radius-full);
    background-color: currentColor;
    opacity: 0.6;
}

.home-journal .post-card__title {
    line-height: 1.3;
}

.home-journal .post-card__excerpt {
    display: -webkit-box;
    margin-bottom: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.home-journal .post-card__more {
    align-self: flex-start;
    margin-top: auto;
    padding-top: var(--spacing-md);
}

/* ==========================================================================
   FAQ teaser: question and answer pairs in two columns
   ========================================================================== */

.home-faq__list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-lg);
    max-width: 60rem;
    margin-inline: auto;
}

@media (min-width: 768px) {
    .home-faq__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-xl) var(--spacing-2xl);
    }
}

.home-faq__item {
    padding-left: var(--spacing-lg);
    border-left: 2px solid var(--color-secondary);
}

.home-faq__question {
    margin-bottom: var(--spacing-sm);
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    line-height: 1.35;
    letter-spacing: var(--letter-spacing-heading);
    color: var(--color-heading);
}

.home-faq__answer {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--color-text-light);
}

/* ==========================================================================
   Reduced motion and print
   ========================================================================== */

/* style.css already zeroes the motion tokens; this covers the hover
   transforms and the sticky heading, which can jump while the page scrolls. */
@media (prefers-reduced-motion: reduce) {
    .home-shop--categories .home-shop__body ul.products.columns-3 li.product-category:hover,
    .home-shop--categories .home-shop__body ul.products.columns-3 li.product-category:hover img,
    .home-journal .post-card:hover .card__media img {
        transform: none;
    }

    .home-process__inner .section-header {
        position: static;
    }
}

@media print {
    .home-trust,
    .home-section__more,
    .home-shop__more,
    .home-paths__more {
        display: none !important;
    }

    .home-process__inner,
    .home-facts__inner {
        display: block;
    }

    .home-paths__grid,
    .home-builds__grid,
    .home-reviews__grid,
    .home-journal__grid,
    .home-faq__list,
    .home-shop--categories .home-shop__body ul.products.columns-3 {
        grid-template-columns: minmax(0, 1fr);
    }

    .card,
    .home-step,
    .home-faq__item {
        break-inside: avoid;
    }
}

/* ==========================================================================
   Newsletter: one card, copy on the left and the form on the right
   ========================================================================== */

.home-newsletter__card {
    display: grid;
    gap: var(--spacing-xl);
    padding: clamp(1.75rem, 1.2rem + 2vw, 3rem);
}

.home-newsletter__title {
    margin-bottom: var(--spacing-sm);
}

.home-newsletter__text {
    margin: 0;
    max-width: 36rem;
}

.home-newsletter__row {
    display: grid;
    gap: 0.75rem;
}

.home-newsletter__row .form__input {
    min-width: 0;
}

.home-newsletter__done {
    margin: 0;
    padding: var(--spacing-md) var(--spacing-lg);
    font-weight: var(--font-weight-medium);
    color: var(--color-success);
    background-color: var(--color-success-light);
    border-radius: var(--radius-md);
}

@media (min-width: 480px) {
    .home-newsletter__row {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
    }
}

@media (min-width: 1024px) {
    .home-newsletter__card {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
        align-items: center;
        gap: var(--spacing-3xl);
    }
}
