/* HESAGRO — responsive fixes (mobile / tablet) */

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--hesagro-nav-height, 5rem) + 1rem);
}

.hesagro-scroll-target {
    scroll-margin-top: calc(var(--hesagro-nav-height, 5rem) + 1rem);
}

html,
body {
    overflow-x: clip;
    max-width: 100%;
}

img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* Tailwind custom tokens that live in spacing, not maxWidth */
.max-w-container-max {
    max-width: min(1280px, 100%) !important;
    width: 100%;
}

.full-width {
    width: 100%;
}

/* Safe horizontal padding on small screens */
@media (max-width: 767px) {
    .px-margin-desktop:not(.md\:px-margin-desktop) {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    .py-section-padding {
        padding-top: 48px !important;
        padding-bottom: 48px !important;
    }

    .pt-20 {
        padding-top: 2.5rem !important;
    }

    .gap-gutter {
        gap: 16px !important;
    }

    /* Typography scale down */
    .text-display-lg,
    .font-display-lg {
        font-size: clamp(1.75rem, 6vw, 2.25rem) !important;
        line-height: 1.15 !important;
    }

    .text-headline-md,
    .font-headline-md {
        font-size: clamp(1.35rem, 4.5vw, 1.75rem) !important;
        line-height: 1.25 !important;
    }

    .text-headline-sm,
    .font-headline-sm {
        font-size: clamp(1.125rem, 3.5vw, 1.35rem) !important;
    }

    .text-body-lg {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }

    /* Nav compact */
    nav .h-20 {
        height: 4rem !important;
    }

    nav .hesagro-nav-logo,
    nav a[href="/"] img {
        height: 2.25rem !important;
    }

    /* Hero image */
    .h-\[400px\] {
        height: min(280px, 55vw) !important;
    }

    .h-\[500px\] {
        height: min(320px, 60vw) !important;
    }

    /* Section headers stack */
    .flex.justify-between.items-end {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem;
    }

    /* Product / category cards */
    .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-3 .p-6,
    .grid.grid-cols-1.sm\:grid-cols-2.xl\:grid-cols-3 .p-5 {
        padding: 1rem !important;
    }

    /* Landing modals */
    .fixed.z-\[100\] .relative.max-w-4xl {
        flex-direction: column !important;
        max-height: 92vh !important;
        overflow-y: auto !important;
    }

    .fixed.z-\[100\] .md\:w-1\/2.h-64 {
        height: 220px !important;
        min-height: 220px !important;
    }

    /* Detail product page (modal layout) */
    body.overflow-hidden {
        overflow-y: auto !important;
    }

    .fixed.inset-0.z-50.flex.items-center.justify-center {
        align-items: flex-start !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
        overflow-y: auto !important;
    }

    .fixed.inset-0.z-50 .max-w-4xl {
        flex-direction: column !important;
        max-height: none !important;
    }

    .fixed.inset-0.z-50 .max-h-\[819px\] {
        max-height: none !important;
    }

    /* Tips featured article */
    .h-\[400px\].overflow-hidden {
        height: 220px !important;
    }

    /* Kontak / forms */
    .grid.grid-cols-1.lg\:grid-cols-2 {
        gap: 2rem !important;
    }

    /* Footer */
    footer .grid.grid-cols-1.md\:grid-cols-4,
    footer.hesagro-site-footer .grid {
        gap: 2rem !important;
    }

    footer.hesagro-site-footer .grid {
        grid-template-columns: 1fr !important;
    }

    /* Floating WA — avoid notch overlap */
    a.fixed.bottom-6.right-6 {
        bottom: 1rem !important;
        right: 1rem !important;
        padding: 0.85rem !important;
    }

    /* Tables / selects full width */
    select.form-select,
    .form-select {
        max-width: 100%;
        width: 100%;
    }

    .flex.flex-col.sm\:flex-row.justify-between.items-start.sm\:items-center select {
        width: 100%;
    }
}

@media (max-width: 639px) {
    .grid.grid-cols-1.sm\:grid-cols-2,
    .grid.grid-cols-1.md\:grid-cols-2,
    .grid.grid-cols-1.md\:grid-cols-3,
    .grid.grid-cols-1.md\:grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
}

/* Footer on dark green — readable even if Tailwind tokens missing after turbo nav */
footer.hesagro-site-footer {
    color: rgba(255, 255, 255, 0.9);
}

footer.hesagro-site-footer h4 {
    color: #ffffff;
}

footer.hesagro-site-footer p,
footer.hesagro-site-footer li,
footer.hesagro-site-footer a {
    color: rgba(255, 255, 255, 0.88);
}

footer.hesagro-site-footer a:hover {
    color: #feb873;
}

footer.hesagro-site-footer .border-t {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Mobile navigation drawer */
body.hesagro-nav-open {
    overflow: hidden;
}

.hesagro-mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    visibility: hidden;
}

.hesagro-mobile-drawer.is-open {
    pointer-events: auto;
    visibility: visible;
}

.hesagro-mobile-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 28, 25, 0.45);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.hesagro-mobile-drawer.is-open .hesagro-mobile-drawer__backdrop {
    opacity: 1;
}

.hesagro-mobile-drawer__panel {
    position: absolute;
    top: 0;
    left: 0;
    width: min(320px, 88vw);
    height: 100%;
    background: #faf9f5;
    border-right: 1px solid #c3c8be;
    box-shadow: 12px 0 40px rgba(46, 74, 46, 0.15);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    gap: 1rem;
}

.hesagro-mobile-drawer.is-open .hesagro-mobile-drawer__panel {
    transform: translateX(0);
}

.hesagro-mobile-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e3e3de;
    font-family: "Libre Caslon Text", serif;
    font-size: 1.25rem;
    color: #183319;
}

.hesagro-mobile-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    border: 1px solid #c3c8be;
    background: #fff;
    color: #434841;
    cursor: pointer;
}

.hesagro-mobile-drawer__links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    overflow-y: auto;
}

.hesagro-mobile-drawer__link {
    display: block;
    padding: 0.85rem 0.75rem;
    border-radius: 0.375rem;
    font-family: Manrope, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #434841;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.hesagro-mobile-drawer__link:hover,
.hesagro-mobile-drawer__link:focus {
    background: #f4f4ef;
    color: #875216;
}

.hesagro-mobile-drawer__link.is-active {
    background: #ffdcbe;
    color: #875216;
}

.hesagro-mobile-drawer__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1rem;
    background: #183319;
    color: #fff;
    font-family: Manrope, sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    text-decoration: none;
    border-radius: 0.25rem;
    margin-top: auto;
}

.hesagro-mobile-drawer__cta:hover {
    background: #2e4a2e;
}

/* Katalog mobile filters */
@media (max-width: 1023px) {
    aside .hesagro-filters-panel.is-open {
        display: block !important;
        margin-top: 0.75rem;
        animation: hesagroSlideDown 0.35s ease;
    }
}

@keyframes hesagroSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 768px) {
    .hesagro-mobile-drawer {
        display: none !important;
    }
}

/* Fixed navbar — stays in place during page swaps */
body > nav {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 50;
}

body > nav .hesagro-nav-logo,
body > nav a[href="/"] img {
    height: 3rem !important;
    width: auto !important;
    max-height: 3rem;
    object-fit: contain;
}

body > nav .h-20 {
    height: 5rem !important;
    min-height: 5rem;
}

body {
    padding-top: var(--hesagro-nav-height, 5rem);
}

/* Subtle content fade — navbar untouched */
@keyframes hesagroContentIn {
    from {
        opacity: 0.6;
    }
    to {
        opacity: 1;
    }
}

main.hesagro-content-enter,
body > header.hesagro-content-enter,
body > footer.hesagro-content-enter {
    animation: hesagroContentIn 0.22s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
    main.hesagro-content-enter,
    body > header.hesagro-content-enter,
    body > footer.hesagro-content-enter {
        animation: none;
    }
}

/* Consistent nav link hover/active — no layout jump */
nav .hidden.md\:flex a.hesagro-nav-link,
nav ul.hidden.md\:flex a.hesagro-nav-link {
    display: inline-flex;
    align-items: center;
    padding-top: 0 !important;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid transparent;
    line-height: 1.25;
    transition:
        color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: none;
}

nav .hidden.md\:flex a.hesagro-nav-link.border-primary,
nav ul.hidden.md\:flex a.hesagro-nav-link.border-primary,
nav .hidden.md\:flex a.hesagro-nav-link.border-secondary,
nav ul.hidden.md\:flex a.hesagro-nav-link.border-secondary,
nav .hidden.md\:flex a.hesagro-nav-link.hesagro-nav-link-active,
nav ul.hidden.md\:flex a.hesagro-nav-link.hesagro-nav-link-active {
    color: #875216;
    border-bottom-color: #875216;
}

nav .hidden.md\:flex a.hesagro-nav-link:hover,
nav ul.hidden.md\:flex a.hesagro-nav-link:hover {
    color: #875216;
}

.hesagro-mobile-drawer__link.hesagro-nav-link {
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Home hero background */
.hesagro-hero {
    position: relative;
    min-height: 420px;
}

.hesagro-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}

.hesagro-hero__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    /* Gradasi gelap tipis di kiri saja — gambar tetap jelas */
    background: linear-gradient(
        90deg,
        rgba(10, 28, 14, 0.62) 0%,
        rgba(10, 28, 14, 0.28) 42%,
        rgba(10, 28, 14, 0.08) 70%,
        transparent 100%
    );
    pointer-events: none;
}

.hesagro-hero__content h1,
.hesagro-hero__content p {
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.hesagro-hero__content p {
    font-size: 0.875rem;
    line-height: 1.65;
}

.hesagro-hero > .max-w-container-max {
    position: relative;
    z-index: 2;
}

/* Katalog category filter */
.katalog-filter-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.375rem;
    font-family: Manrope, sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #434841;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.katalog-filter-link:hover {
    background: #f4f4ef;
    color: #183319;
}

.katalog-filter-link.is-active {
    background: #caecc5;
    color: #183319;
    font-weight: 600;
}

/* Tips Bertani — layout & sidebar */
.hesagro-tips-main {
    min-width: 0;
}

.hesagro-tips-main > .lg\:col-span-8,
.hesagro-tips-sidebar {
    min-width: 0;
}

.hesagro-tips-cat-link > span:last-child {
    flex-shrink: 0;
}

@media (max-width: 767px) {
    .hesagro-tips-page-header {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    .hesagro-tips-sidebar .rounded-xl.border {
        padding: 1rem !important;
    }

    .hesagro-tips-main .hesagro-tips-featured .p-5 {
        padding: 1rem !important;
    }

    .hesagro-tips-main .grid.md\:grid-cols-2 article .p-6 {
        padding: 1rem !important;
    }

    .hesagro-tips-cat-link {
        flex-wrap: wrap;
    }

    .hesagro-tips-main nav[role="navigation"],
    .hesagro-tips-main .pagination {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
}

@media (min-width: 1024px) {
    .hesagro-tips-sidebar {
        position: sticky;
        top: calc(var(--hesagro-nav-height, 5rem) + 1.5rem);
        align-self: start;
    }
}

.hesagro-tips-detail {
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 767px) {
    .hesagro-tips-detail img {
        max-height: min(280px, 55vw);
        margin-bottom: 1.5rem !important;
    }

    .hesagro-tips-detail h1 {
        font-size: clamp(1.35rem, 5vw, 1.75rem) !important;
        line-height: 1.25 !important;
    }
}
