/* Homepage. Scoped to #homePage. Tokens come from :root in main.css. */

#homePage {
    --hm-ink: #14211b;
    --hm-ink-soft: #3f4f47;
    --hm-line: rgba(20, 33, 27, 0.12);
    --hm-paper: #f6f4ee;
    --hm-green: var(--primary);
    --hm-green-deep: #0f3d29;
    --hm-gold: var(--secondary);
    --hm-measure: 62ch;
}

#homePage h1,
#homePage h2,
#homePage h3 {
    text-wrap: balance;
    color: var(--hm-ink);
}

#homePage ::selection { background: rgba(201, 162, 39, 0.35); color: var(--hm-ink); }

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

/* Buttons and links */
.hm-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 12px 22px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.98rem;
    line-height: 1.2;
    border: 1.5px solid transparent;
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}
.hm-btn-solid { background: var(--hm-green); color: #fff; border-color: var(--hm-green); }
.hm-btn-solid:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.hm-btn-ghost { background: transparent; color: var(--hm-green); border-color: rgba(26, 95, 63, 0.45); }
.hm-btn-ghost:hover { border-color: var(--hm-green); background: rgba(26, 95, 63, 0.06); color: var(--hm-green); }

.hm-textlink {
    color: var(--hm-green);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 4px;
    text-decoration-color: rgba(26, 95, 63, 0.4);
}
.hm-textlink:hover { text-decoration-color: var(--hm-green); }

/* Hero */
.hm-hero {
    background: var(--hm-paper);
    border-bottom: 1px solid var(--hm-line);
    padding: 72px 0 64px;
}
.hm-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(40px, 6vw, 88px);
    align-items: start;
}
.hm-hero-origin {
    margin: 0 0 22px;
    padding-left: 14px;
    border-left: 2px solid var(--hm-gold);
    color: var(--hm-ink-soft);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.2;
}
.hm-hero-copy h1 {
    font-size: clamp(2.3rem, 4.2vw, 3.6rem);
    line-height: 1.06;
    letter-spacing: -0.03em;
    font-weight: 700;
    max-width: 20ch;
    margin: 0 0 24px;
}
.hm-hero-lead {
    max-width: var(--hm-measure);
    color: var(--hm-ink-soft);
    font-size: 1.08rem;
    line-height: 1.7;
    margin: 0 0 32px;
}
.hm-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hm-hero-visual { margin: 0; }
.hm-hero-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    border-radius: 6px;
    box-shadow: 0 24px 48px -28px rgba(15, 61, 41, 0.45), 0 6px 14px -8px rgba(20, 33, 27, 0.18);
    background: var(--hm-green-deep);
}
.hm-hero-slider img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 700ms ease;
}
.hm-hero-slider img.active { opacity: 1; }
.hm-hero-visual figcaption {
    margin-top: 12px;
    font-size: 0.82rem;
    color: var(--hm-ink-soft);
    line-height: 1.5;
}

/* Process */
.hm-process { background: #fff; padding: 88px 0 80px; }
.hm-process-head {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 32px 64px;
    align-items: end;
    margin-bottom: 48px;
}
.hm-process-head h2 {
    font-size: clamp(1.8rem, 2.8vw, 2.4rem);
    line-height: 1.12;
    letter-spacing: -0.025em;
    margin: 0;
}
.hm-process-head p {
    margin: 0;
    color: var(--hm-ink-soft);
    line-height: 1.65;
    max-width: var(--hm-measure);
}
.hm-process-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--hm-line);
}
.hm-process-steps li {
    counter-increment: hm-step;
    padding: 28px 28px 8px 0;
    border-right: 1px solid var(--hm-line);
    margin-right: 28px;
}
.hm-process-steps li:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.hm-process-steps h3 {
    font-size: 1.08rem;
    line-height: 1.3;
    margin: 0 0 12px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.hm-process-steps h3::before {
    content: counter(hm-step);
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--hm-gold);
    color: var(--hm-ink);
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-2px);
}
.hm-process-steps p {
    margin: 0;
    color: var(--hm-ink-soft);
    font-size: 0.95rem;
    line-height: 1.65;
}

/* Partner */
.hm-partner { background: var(--hm-paper); border-top: 1px solid var(--hm-line); border-bottom: 1px solid var(--hm-line); padding: 80px 0; }
.hm-partner-inner {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    gap: 40px clamp(40px, 6vw, 96px);
    align-items: start;
}
.hm-partner-copy { position: sticky; top: 96px; }
.hm-partner-copy h2 {
    font-size: clamp(1.7rem, 2.5vw, 2.2rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin: 0 0 18px;
}
.hm-partner-copy p {
    color: var(--hm-ink-soft);
    line-height: 1.65;
    margin: 0 0 22px;
}
.hm-partner-list { display: grid; gap: 0; border-top: 1px solid var(--hm-line); }
.hm-partner-item {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 28px;
    padding: 26px 0;
    border-bottom: 1px solid var(--hm-line);
    align-items: center;
}
.hm-partner-media {
    aspect-ratio: 4 / 3;
    border-radius: 4px;
    background-color: var(--hm-green-deep);
    background-size: cover;
    background-position: center;
}
.hm-partner-text h3 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 8px; }
.hm-partner-text p { margin: 0; color: var(--hm-ink-soft); line-height: 1.65; font-size: 0.97rem; }

/* Row heads shared by categories + featured */
.hm-row-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px 32px;
    margin-bottom: 28px;
}
.hm-row-head h2 {
    font-size: clamp(1.6rem, 2.3vw, 2rem);
    letter-spacing: -0.02em;
    margin: 0;
}
.hm-row-head p {
    flex: 1 1 100%;
    margin: 0;
    color: var(--hm-ink-soft);
    line-height: 1.6;
    max-width: var(--hm-measure);
}

/* Categories */
.hm-categories { background: #fff; padding: 72px 0 56px; }
#homePage .hm-categories-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
#homePage .hm-categories-grid .category-card {
    cursor: pointer;
    min-height: 0;
    padding: 22px 18px;
    text-align: left;
    border: 1px solid var(--hm-line);
    border-radius: 6px;
    box-shadow: none;
    background: #fff;
    transition: border-color 160ms ease, background-color 160ms ease;
}
#homePage .hm-categories-grid .category-card:hover { transform: none; border-color: var(--hm-green); background: rgba(26, 95, 63, 0.04); box-shadow: none; }
#homePage .hm-categories-grid .category-icon {
    width: 40px;
    height: 40px;
    margin: 0 0 16px;
    border-radius: 6px;
    background: rgba(26, 95, 63, 0.1);
    color: var(--hm-green);
    font-size: 1.05rem;
    box-shadow: none;
}
#homePage .hm-categories-grid .category-card h3 { font-size: 1rem; margin: 0 0 2px; }
#homePage .hm-categories-grid .category-card p { font-size: 0.85rem; color: var(--hm-ink-soft); }
#homePage .hm-categories-grid > div[style] { color: var(--hm-ink-soft); }

/* Featured products */
#homePage .hm-featured { background: var(--hm-paper); border-top: 1px solid var(--hm-line); padding: 64px 0 80px; }
.hm-featured .hm-row-head { align-items: flex-start; margin-bottom: 0; }
.hm-featured .hm-row-head > div { max-width: 720px; }
.hm-featured .hm-row-head h2 {
    font-size: clamp(2rem, 3vw, 2.7rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
    max-width: 18ch;
}
.hm-featured .hm-row-head p { margin-top: 16px; max-width: 62ch; font-size: 1rem; }
.hm-featured .hm-textlink { margin-top: 10px; white-space: nowrap; }
.hm-featured-guide {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    gap: 32px 64px;
    align-items: start;
    margin: 38px 0 32px;
    padding: 22px 0;
    border-top: 1px solid var(--hm-line);
    border-bottom: 1px solid var(--hm-line);
}
.hm-featured-guide > p {
    margin: 0;
    color: var(--hm-ink);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.5;
}
.hm-featured-guide ol {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}
.hm-featured-guide li { position: relative; min-width: 0; padding: 0 20px 0 44px; }
.hm-featured-guide li:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    right: -1px;
    left: 38px;
    border-top: 1px dashed rgba(20, 33, 27, 0.34);
    z-index: 0;
}
.hm-featured-step {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--hm-green-deep);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}
.hm-featured-guide strong { display: block; margin-bottom: 5px; color: var(--hm-green-deep); font-size: 0.92rem; }
.hm-featured-guide li > div > span { display: block; color: var(--hm-ink-soft); font-size: 0.88rem; line-height: 1.5; }
#homePage .hm-products-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
#homePage .hm-products-grid .product-card {
    border: 1px solid var(--hm-line);
    border-radius: 6px;
    box-shadow: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
#homePage .hm-products-grid .product-card:hover { transform: none; border-color: rgba(26, 95, 63, 0.5); box-shadow: 0 14px 28px -20px rgba(15, 61, 41, 0.4); }
#homePage .hm-products-grid .product-image { height: 200px; }
#homePage .hm-products-grid .product-actions { opacity: 1; }
#homePage .hm-products-grid > div[style] { background: #fff; border: 1px dashed var(--hm-line); border-radius: 6px; }

/* Contact */
.hm-contact { background: var(--hm-green-deep); color: #fff; padding: 72px 0; }
.hm-contact-inner {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 32px 64px;
    align-items: center;
}
#homePage .hm-contact h2 {
    color: #fff;
    font-size: clamp(1.7rem, 2.6vw, 2.3rem);
    line-height: 1.12;
    letter-spacing: -0.025em;
    margin: 0 0 14px;
}
#homePage .hm-contact p { margin: 0; color: #cfe0d6; line-height: 1.65; max-width: var(--hm-measure); }
.hm-contact-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.hm-contact .hm-btn-solid { background: var(--hm-gold); border-color: var(--hm-gold); color: var(--hm-ink); }
.hm-contact .hm-btn-solid:hover { background: var(--secondary-dark); border-color: var(--secondary-dark); color: var(--hm-ink); }
.hm-contact .hm-btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.hm-contact .hm-btn-ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); color: #fff; }

/* Focus, keyboard */
#homePage .hm-btn:focus-visible,
#homePage .hm-textlink:focus-visible {
    outline: 2px solid var(--hm-gold);
    outline-offset: 3px;
}

/* Responsive */
@media (max-width: 1100px) {
    #homePage .hm-categories-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    #homePage .hm-products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hm-process-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 8px; }
    .hm-process-steps li:nth-child(2) { border-right: 0; margin-right: 0; padding-right: 0; }
}

@media (max-width: 900px) {
    .hm-hero { padding: 48px 0 44px; }
    .hm-hero-inner { grid-template-columns: 1fr; gap: 36px; }
    .hm-hero-copy { display: contents; }
    .hm-hero-origin { order: 1; }
    .hm-hero-copy h1 { order: 2; max-width: none; }
    .hm-hero-lead { order: 3; }
    .hm-hero-visual { order: 4; }
    .hm-hero-actions { order: 5; }
    .hm-hero-slider { aspect-ratio: 16 / 10; }
    .hm-process { padding: 64px 0 56px; }
    .hm-process-head { grid-template-columns: 1fr; gap: 14px; margin-bottom: 32px; }
    .hm-partner { padding: 60px 0; }
    .hm-partner-inner { grid-template-columns: 1fr; gap: 28px; }
    .hm-partner-copy { position: static; }
    .hm-categories { padding: 56px 0 40px; }
    #homePage .hm-featured { padding: 48px 0 60px; }
    .hm-featured-guide { grid-template-columns: 1fr; gap: 20px; margin-top: 30px; }
    #homePage .hm-products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hm-contact { padding: 56px 0; }
    .hm-contact-inner { grid-template-columns: 1fr; gap: 24px; }
    .hm-contact-actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
    .hm-hero-copy h1 { font-size: clamp(1.9rem, 8vw, 2.4rem); }
    .hm-hero-lead { font-size: 1rem; }
    .hm-hero-actions .hm-btn { flex: 1 1 100%; justify-content: center; }
    .hm-process-steps { grid-template-columns: 1fr; }
    .hm-process-steps li { border-right: 0; margin-right: 0; padding: 22px 0 6px; border-bottom: 1px solid var(--hm-line); }
    .hm-process-steps li:last-child { border-bottom: 0; }
    .hm-partner-item { grid-template-columns: 1fr; gap: 14px; }
    .hm-partner-media { aspect-ratio: 16 / 9; }
    #homePage .hm-categories { overflow: hidden; }
    #homePage .hm-categories-grid {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        padding: 0 0 12px;
        margin-bottom: -12px;
        scrollbar-width: thin;
    }
    #homePage .hm-categories-grid .category-card {
        flex: 0 0 min(78vw, 280px);
        min-width: 0;
        padding: 16px 14px;
        scroll-snap-align: start;
    }
    .hm-featured .hm-row-head h2 { max-width: none; }
    .hm-featured .hm-textlink { margin-top: 0; white-space: normal; }
    .hm-featured-guide { margin-bottom: 24px; padding: 18px 0; }
    .hm-featured-guide ol {
        position: relative;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: 8px;
        row-gap: 22px;
        padding: 10px 0;
    }
    .hm-featured-guide li {
        display: block;
        padding: 0;
    }
    .hm-featured-guide li:nth-child(1) { grid-column: 1; }
    .hm-featured-guide li:nth-child(2) { grid-column: 3; }
    .hm-featured-guide li:nth-child(3) {
        grid-column: 2;
        width: auto;
    }
    .hm-featured-guide li:not(:last-child)::after {
        top: 19px;
        left: 34px;
        right: auto;
        width: calc(200% - 18px);
        border-top-color: rgba(20, 33, 27, 0.42);
    }
    .hm-featured-guide li:nth-child(2)::after {
        left: 15px;
        top: 38px;
        width: 130%;
        transform: rotate(148deg);
        transform-origin: left center;
    }
    .hm-featured-guide li:nth-child(3)::before {
        content: '';
        position: absolute;
        top: -7px;
        left: 18px;
        width: 115%;
        border-top: 1px dashed rgba(20, 33, 27, 0.42);
        transform: rotate(-147deg);
        transform-origin: left center;
        z-index: 0;
    }
    .hm-featured-step {
        position: relative;
        width: 30px;
        height: 30px;
        margin: 4px;
    }
    .hm-featured-step::after {
        content: '';
        position: absolute;
        inset: -5px;
        border: 1px dashed rgba(20, 33, 27, 0.52);
        border-radius: inherit;
    }
    .hm-featured-guide li > div {
        position: relative;
        z-index: 1;
        margin-top: 10px;
        padding-right: 4px;
        background: var(--hm-paper);
    }
    .hm-featured-guide strong { margin-bottom: 2px; }
    .hm-featured-guide li > div > span { font-size: 0.82rem; line-height: 1.42; }
    #homePage .hm-products-grid { grid-template-columns: 1fr; }
    .hm-contact-actions .hm-btn { flex: 1 1 100%; justify-content: center; }
}
