/* ---- Home page polish ----------------------------------------------------------------------------------------------
   Section headings, product cards and the counters band. Loaded last (after site-footer.css); selectors lead with `html`
   to outrank the template's Style.css / hoverimg.css. Colours come from custom properties so the dark theme only
   swaps values. */
html {
    --home-card: #fff;
    --home-line: #e3e8ef;
    --home-shadow: 0 10px 30px rgba(7, 21, 37, 0.1);
    --home-shadow-hover: 0 18px 40px rgba(7, 21, 37, 0.2);
    --home-muted: #5b6b80;
}

html[data-theme="dark"] {
    --home-card: #101f33;
    --home-line: #223a57;
    --home-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --home-shadow-hover: 0 18px 40px rgba(0, 0, 0, 0.6);
    --home-muted: #9fb0c6;
}

/* ---- Section heading: small accent label, bold title, short accent bar ---- */
.home-title {
    margin-bottom: 0.5rem;
    text-align: center;
}

.home-title span {
    background: rgba(22, 133, 255, 0.12);
    border-radius: 999px;
    color: #1685ff;
    display: inline-block;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    padding: 0.25rem 0.9rem;
}

.home-title h2 {
    font-size: clamp(1.5rem, 3.4vw, 2.2rem);
    line-height: 1.4;
    margin: 0.6rem 0 0;
    padding-bottom: 0.9rem;
    position: relative;
}

.home-title h2::after {
    background: linear-gradient(90deg, #1685ff, #4aa3ff);
    border-radius: 3px;
    content: "";
    height: 4px;
    inset-inline-start: 50%;
    position: absolute;
    bottom: 0;
    transform: translateX(-50%);
    width: 3.5rem;
}

[dir="rtl"] .home-title h2::after {
    transform: translateX(50%);
}

/* ---- Product cards: image on top, name + blurb, then price and a details cue. Theme colours come from the
   --home-* properties above, so dark mode needs no extra rules. ---- */
html .home-products .row > [class*="col-"] {
    display: flex;
}

html .hp-card {
    background: var(--home-card);
    border: 1px solid var(--home-line);
    border-radius: 1.1rem;
    box-shadow: var(--home-shadow);
    color: inherit;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-align: start;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    width: 100%;
}

html .hp-card:hover,
html .hp-card:focus-visible {
    border-color: #1685ff;
    box-shadow: var(--home-shadow-hover);
    color: inherit;
    transform: translateY(-6px);
}

html .hp-media {
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #0b4fb3 0%, #1685ff 55%, #4aa3ff 100%);
    display: block;
    overflow: hidden;
    position: relative;
}

/* The initial shows through only when there is no image, or it failed to load (the img hides itself). */
html .hp-media::before {
    color: rgba(255, 255, 255, 0.85);
    content: attr(data-initial);
    font-size: 3.5rem;
    font-weight: 700;
    inset: 0;
    line-height: 1;
    place-content: center;
    display: grid;
    position: absolute;
}

html .hp-media img {
    height: 100%;
    inset: 0;
    object-fit: cover;
    position: absolute;
    transition: transform 0.5s ease;
    width: 100%;
}

html .hp-card:hover .hp-media img {
    transform: scale(1.06);
}

html .hp-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1.1rem 1.25rem 1.2rem;
}

html .hp-name {
    color: var(--home-title, inherit);
    font-size: 1.1rem;
    line-height: 1.4;
}

html .hp-desc {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: var(--home-muted);
    display: -webkit-box;
    font-size: 0.9rem;
    line-height: 1.7;
    overflow: hidden;
}

html .hp-foot {
    align-items: center;
    border-top: 1px solid var(--home-line);
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 0.8rem;
}

html .hp-price {
    color: var(--home-muted);
    font-size: 0.85rem;
}

html .hp-price strong {
    color: #1685ff;
    font-size: 0.95rem;
}

html .hp-more {
    align-items: center;
    color: #1685ff;
    display: inline-flex;
    font-size: 0.85rem;
    gap: 0.35rem;
    white-space: nowrap;
}

html .hp-more i {
    border-block-start: 2px solid currentColor;
    border-inline-end: 2px solid currentColor;
    height: 0.5rem;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    width: 0.5rem;
}

[dir="rtl"] html .hp-more i,
html[dir="rtl"] .hp-more i {
    transform: rotate(-135deg);
}

html .hp-card:hover .hp-more i {
    transform: translateX(3px) rotate(45deg);
}

html[dir="rtl"] .hp-card:hover .hp-more i {
    transform: translateX(-3px) rotate(-135deg);
}

html[data-theme="dark"] .hp-card { --home-title: #f1f5fb; }
html:not([data-theme="dark"]) .hp-card { --home-title: #0b1b2e; }

/* ---- Counters band: frosted tiles over the photo ---- */
html .banner-bui {
    overflow: hidden;
}

html .banner-bui .stats {
    margin-bottom: 0.5rem;
}

html .banner-bui .stats > .d-flex,
html .banner-bui .stats > h5 {
    position: relative;
}

html .banner-bui .row > .stats {
    backdrop-filter: blur(6px);
    background: rgba(7, 21, 37, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1rem;
    margin: 0.5rem 0;
    padding: 1rem !important;
}

@media (min-width: 576px) {
    html .banner-bui .row > .stats {
        margin-inline: 0.4rem;
        max-width: calc(33.333% - 0.8rem);
    }
}

html .banner-bui .stats h5 {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    margin: 0.4rem 0 0;
}

/* ---- Rhythm: a little more air between the home sections on phones ---- */
@media (max-width: 575.98px) {
    html .home-products {
        margin-top: 2.5rem !important;
    }

    html .home-products .row > [class*="col-"] {
        margin-bottom: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html .hp-card,
    html .hp-media img {
        transition: none;
    }

    html .hp-card:hover,
    html .hp-card:hover .hp-media img {
        transform: none;
    }
}
