/*
 * Malek Agriculture mobile homepage (v2.1).
 *
 * The existing approved desktop presentation remains untouched. The alternate
 * homepage below is activated only for viewports narrower than 768 px.
 */

body.malek-rd .rd-mobile-home { display: none; }
body.malek-rd .rd-home-desktop { display: contents; }

@media (max-width: 767px) {
    body.malek-rd {
        --rdm-cream: #f8f5ed;
        --rdm-white: #ffffff;
        --rdm-sage: #dce8d7;
        --rdm-olive: #71865d;
        --rdm-deep: #273d2e;
        --rdm-gold: #b49a43;
        --rdm-ink: #273d2e;
        background: var(--rdm-cream);
    }

    body.malek-rd .rd-home-desktop { display: none; }
    body.malek-rd .rd-mobile-home { display: block; overflow: clip; background: var(--rdm-cream); }
    /*
     * Compact header: hide only the dark utility bar above the header. The white header,
     * logo and hamburger toggle are deliberately NOT restyled here. They keep the 2.0.1
     * rules (redesign.css) so that any production Customizer CSS for the mobile menu
     * applies to the homepage exactly as it does on every other page.
     */
    body.malek-rd .rd-utility { display: none; }

    body.malek-rd .rdm-shell { width: 100%; max-width: 34rem; margin-inline: auto; padding-inline: 1.25rem; box-sizing: border-box; }
    body.malek-rd .rdm-section { padding-block: 3.5rem; }
    body.malek-rd .rdm-section h2,
    body.malek-rd .rdm-contact h2 { margin: 0; color: var(--rdm-ink); font-size: clamp(1.8rem, 8vw, 2.35rem); line-height: 1.08; }
    body.malek-rd .rdm-eyebrow {
        display: inline-block;
        margin-bottom: 0.75rem;
        color: var(--rdm-olive);
        font-size: 0.76rem;
        font-weight: 700;
        letter-spacing: 0.13em;
        text-transform: uppercase;
    }

    body.malek-rd .rdm-hero { position: relative; min-height: min(660px, calc(100svh - 64px)); display: flex; align-items: flex-end; color: var(--rdm-white); background: var(--rdm-deep); isolation: isolate; }
    body.malek-rd .rdm-hero__media { position: absolute; inset: 0; z-index: -2; }
    body.malek-rd .rdm-hero__media img { width: 100%; height: 100%; object-fit: cover; object-position: 58% center; }
    body.malek-rd .rdm-hero::after { position: absolute; inset: 0; z-index: -1; content: ""; background: linear-gradient(180deg, rgba(39, 61, 46, 0.05) 12%, rgba(39, 61, 46, 0.32) 48%, rgba(24, 40, 29, 0.92) 100%); }
    body.malek-rd .rdm-hero__content { padding-block: 5.5rem 3rem; }
    body.malek-rd .rdm-hero h1 { max-width: 10ch; margin: 0 0 1rem; color: var(--rdm-white); font-size: clamp(2.55rem, 11vw, 3.55rem); line-height: 0.98; }
    body.malek-rd .rdm-hero p { max-width: 30ch; margin: 0 0 1.6rem; color: rgba(255, 255, 255, 0.9); font-size: 1.05rem; line-height: 1.55; }

    body.malek-rd .rdm-button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 0.65rem; padding: 0.78rem 1.2rem; color: var(--rdm-deep); font-size: 0.92rem; font-weight: 700; text-decoration: none; border-radius: 999px; }
    body.malek-rd .rdm-button--gold { background: var(--rdm-gold); }
    body.malek-rd .rdm-button--gold:hover { color: var(--rdm-deep); background: #c4aa52; }
    body.malek-rd .rdm-button--light { color: var(--rdm-deep); background: var(--rdm-white); }

    body.malek-rd .rdm-products { background: var(--rdm-cream); }
    body.malek-rd .rdm-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
    body.malek-rd .rdm-heading-row > a,
    body.malek-rd .rdm-text-link { flex: 0 0 auto; color: var(--rdm-deep); font-size: 0.85rem; font-weight: 700; text-decoration: none; }
    body.malek-rd .rdm-product-list { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; }
    body.malek-rd .rdm-product-card { overflow: hidden; background: var(--rdm-white); border: 1px solid rgba(39, 61, 46, 0.09); border-radius: 1.1rem; box-shadow: 0 10px 28px rgba(39, 61, 46, 0.07); }
    body.malek-rd .rdm-product-card > a { display: grid; min-height: 118px; grid-template-columns: 118px minmax(0, 1fr); color: var(--rdm-ink); text-decoration: none; }
    body.malek-rd .rdm-product-card__media { display: block; overflow: hidden; background: var(--rdm-sage); }
    body.malek-rd .rdm-product-card__media img { width: 100%; height: 100%; object-fit: cover; }
    body.malek-rd .rdm-product-card__body { position: relative; display: flex; min-width: 0; flex-direction: column; justify-content: center; gap: 0.25rem; padding: 1rem 2.75rem 1rem 1rem; }
    body.malek-rd .rdm-product-card__category { color: var(--rdm-olive); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
    body.malek-rd .rdm-product-card strong { overflow-wrap: anywhere; font-family: var(--rd-serif); font-size: 1.18rem; line-height: 1.15; }
    body.malek-rd .rdm-product-card__arrow { position: absolute; right: 1rem; color: var(--rdm-gold); font-size: 1.25rem; }

    /*
     * Original YouTube video: full-width 16:9 player. The padding ratio (56.25%)
     * keeps the 16:9 box on browsers without aspect-ratio support (iOS Safari < 15).
     */
    body.malek-rd .rdm-video { padding-block: 0 3.5rem; background: var(--rdm-cream); }
    body.malek-rd .rdm-video h2 { margin-bottom: 1.25rem; }
    body.malek-rd .rdm-video__frame { position: relative; width: 100%; height: 0; padding-top: 56.25%; overflow: hidden; background: var(--rdm-deep); border-radius: 1.1rem; box-shadow: 0 10px 28px rgba(39, 61, 46, 0.12); }
    body.malek-rd .rdm-video__frame iframe { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: 100%; border: 0; }

    body.malek-rd .rdm-values { padding-block: 2rem; background: var(--rdm-sage); }
    body.malek-rd .rdm-values__grid { display: grid; gap: 0; }
    body.malek-rd .rdm-values article { padding-block: 1.25rem; border-bottom: 1px solid rgba(39, 61, 46, 0.13); }
    body.malek-rd .rdm-values article:last-child { border-bottom: 0; }
    body.malek-rd .rdm-values h3 { margin: 0 0 0.45rem; color: var(--rdm-deep); font-size: 1.3rem; }
    body.malek-rd .rdm-values p { margin: 0; color: rgba(39, 61, 46, 0.76); font-size: 0.94rem; line-height: 1.55; }

    body.malek-rd .rdm-about { background: var(--rdm-white); }
    body.malek-rd .rdm-about h2 { margin-bottom: 1rem; }
    body.malek-rd .rdm-about p { margin: 0 0 1.25rem; color: #526359; line-height: 1.7; }

    body.malek-rd .rdm-contact { padding-block: 3.5rem; color: var(--rdm-white); background: var(--rdm-deep); }
    body.malek-rd .rdm-contact .rdm-eyebrow { color: #d7c676; }
    body.malek-rd .rdm-contact h2 { color: var(--rdm-white); }
    body.malek-rd .rdm-contact ul { display: grid; gap: 0.8rem; margin: 1.6rem 0; padding: 0; list-style: none; }
    body.malek-rd .rdm-contact li { display: grid; gap: 0.12rem; }
    body.malek-rd .rdm-contact li span { color: rgba(255, 255, 255, 0.62); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
    body.malek-rd .rdm-contact li a { color: var(--rdm-white); overflow-wrap: anywhere; text-decoration-color: rgba(255, 255, 255, 0.4); }

    /* The homepage already presents the company and contacts; avoid repeating them in its footer. */
    body.malek-rd-home .rd-footer__brand,
    body.malek-rd-home .rd-footer__contacts { display: none; }
    body.malek-rd-home .rd-footer__grid { gap: 2rem; padding-block: 2.5rem; }
}

@media (min-width: 430px) and (max-width: 767px) {
    body.malek-rd .rdm-shell { padding-inline: 1.5rem; }
    body.malek-rd .rdm-product-card > a { grid-template-columns: 132px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: no-preference) and (max-width: 767px) {
    body.malek-rd .rdm-product-card { transition: transform 180ms ease, box-shadow 180ms ease; }
    body.malek-rd .rdm-product-card:active { transform: scale(0.985); box-shadow: 0 5px 16px rgba(39, 61, 46, 0.08); }
}
