/* =================================================================
   Alfarhan Equipment - visual polish layer
   Loaded after all other styles. Keeps the existing design, colors and
   text; adds a compact header, working mobile menu, whole-crane images,
   and smooth motion. Selectors start with "html body" so they win over
   the per-page <style> blocks without needing !important everywhere.
   ================================================================= */

:root {
    --brand-green: #1B4C24;
    --brand-green-2: #2a6b36;
    --brand-blue: #0d6efd;
    --header-h: 62px;
    --ease: cubic-bezier(.22, .61, .36, 1);
    --radius: 14px;
    --shadow-sm: 0 2px 10px rgba(16, 24, 40, .06);
    --shadow-md: 0 10px 30px rgba(16, 24, 40, .10);
    --shadow-lg: 0 18px 45px rgba(16, 24, 40, .16);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

html body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-top: var(--header-h);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html body h1, html body h2, html body h3, html body h4, html body h5 {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    letter-spacing: -.01em;
}
html body.lang-rtl h1, html body.lang-rtl h2, html body.lang-rtl h3 { letter-spacing: 0; }

html body img { max-width: 100%; }

/* ---------------------------------------------------------------
   Header: shorter, glassy on scroll
   --------------------------------------------------------------- */
html body #header {
    height: auto;
    min-height: var(--header-h);
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 1px 0 rgba(16, 24, 40, .06);
    transition: box-shadow .3s var(--ease), background-color .3s var(--ease);
}
html body #header.scrolled {
    background: rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    box-shadow: 0 6px 24px rgba(16, 24, 40, .08);
}
html body #header .navbar {
    padding-top: 6px;
    padding-bottom: 6px;
    min-height: var(--header-h);
}
html body #header .navbar > .container-fluid { padding-left: 0; padding-right: 0; }
html body #header .navbar-brand { padding: 0; margin: 0; display: flex; align-items: center; }
html body #header .navbar-brand img {
    height: 50px;
    width: auto;
    transition: transform .3s var(--ease);
}
html body #header .navbar-brand:hover img { transform: scale(1.03); }

/* Desktop links */
html body #header .navbar-nav { gap: 4px; }
html body #header .nav-link {
    position: relative;
    font-weight: 600;
    font-size: .98rem;
    color: #2b2f33;
    padding: 8px 14px;
    border-radius: 10px;
    transition: color .25s var(--ease), background-color .25s var(--ease);
}
html body #header .nav-link::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 3px;
    height: 2px;
    width: auto;
    background: var(--brand-green);
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform .3s var(--ease);
}
html body #header .nav-link:hover,
html body #header .nav-link.active { color: var(--brand-green); }
html body #header .nav-link:hover::after,
html body #header .nav-link.active::after { transform: scaleX(1); }

html body #header .lang-switch {
    border-radius: 999px;
    padding: 6px 16px;
    font-weight: 600;
    transition: all .25s var(--ease);
}
html body #header .lang-switch:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13, 110, 253, .25); }

/* Hamburger button -> animated X */
html body #header .navbar-toggler {
    border: 0;
    padding: 10px 8px;
    border-radius: 10px;
    box-shadow: none;
    width: 44px;
    height: 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
html body #header .navbar-toggler:focus { box-shadow: 0 0 0 3px rgba(27, 76, 36, .2); }
html body #header .navbar-toggler .bar {
    display: block;
    width: 24px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--brand-green);
    transition: transform .3s var(--ease), opacity .2s var(--ease);
}
html body #header .navbar-toggler[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
html body #header .navbar-toggler[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
html body #header .navbar-toggler[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* Mobile menu panel */
@media (max-width: 991.98px) {
    html body #header .navbar-toggler { display: inline-flex; }
    :root { --header-h: 58px; }
    html body #header .navbar-brand img { height: 44px; }
    html body #header .navbar-collapse {
        margin: 6px -12px 0;
        padding: 8px 12px 14px;
        border-top: 1px solid rgba(16, 24, 40, .06);
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
    }
    html body #header .navbar-nav {
        display: flex;
        flex-direction: column;
        gap: 2px;
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        padding: 0;
        width: auto;
        align-items: stretch;
    }
    html body #header .nav-link {
        padding: 12px 14px;
        font-size: 1.05rem;
    }
    html body #header .nav-link::after { display: none; }
    html body #header .nav-link:hover,
    html body #header .nav-link.active { background: rgba(27, 76, 36, .07); }
    html body #header .navbar-collapse .d-flex { padding: 10px 14px 0; }
    html body #header .lang-switch { width: 100%; padding: 10px 16px; }

    /* links slide in one after another when the menu opens */
    html body #header .navbar-collapse.show .nav-item {
        animation: navItemIn .35s var(--ease) both;
    }
    html body #header .navbar-collapse.show .nav-item:nth-child(2) { animation-delay: .04s; }
    html body #header .navbar-collapse.show .nav-item:nth-child(3) { animation-delay: .08s; }
    html body #header .navbar-collapse.show .nav-item:nth-child(4) { animation-delay: .12s; }
}
@keyframes navItemIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------
   Home hero slider
   --------------------------------------------------------------- */
html body .hero-slider {
    height: min(calc(100vh - var(--header-h)), 760px);
    min-height: 420px;
    margin-top: 0;
}
html body .slide { transition: opacity 1.1s var(--ease); }
html body .slide .slide-image { transform: scale(1.06); transition: transform 7s linear; }
html body .slide.active .slide-image { transform: scale(1); }
html body .slider-overlay {
    background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,.55) 65%, rgba(0,0,0,.65) 100%);
}
html body .slide.active .slider-content > * { animation: heroTextIn .9s var(--ease) both; }
html body .slide.active .slider-content > *:nth-child(2) { animation-delay: .15s; }
html body .slide.active .slider-content > *:nth-child(3) { animation-delay: .3s; }
@keyframes heroTextIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}
html body .slider-arrow {
    width: 46px;
    height: 46px;
    background: rgba(255, 255, 255, .18);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, .3);
    transition: background-color .25s var(--ease), transform .25s var(--ease);
}
html body .slider-arrow:hover { background: rgba(255, 255, 255, .32); transform: scale(1.08); }
html body .slider-dot { transition: width .3s var(--ease), background-color .3s var(--ease); }
html body .slider-dot.active { width: 28px; border-radius: 6px; background: #fff; }

@media (max-width: 767.98px) {
    html body .hero-slider { height: 62vh; min-height: 340px; }
    html body .slider-content h1 { font-size: 1.75rem; line-height: 1.35; }
    html body .slider-arrow { width: 38px; height: 38px; font-size: 15px; }
    html body .slider-arrows { padding: 0 10px; }
}

/* ---------------------------------------------------------------
   Crane cards: show the WHOLE crane, gentle zoom that never clips
   --------------------------------------------------------------- */
html body .featured-card,
html body .equipment-card,
html body .crane-card {
    border-radius: var(--radius);
    border: 1px solid rgba(16, 24, 40, .07);
    box-shadow: var(--shadow-sm);
    transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .4s var(--ease);
    will-change: transform;
}
html body .featured-card:hover,
html body .equipment-card:hover,
html body .crane-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(27, 76, 36, .18);
}

html body .featured-image,
html body .equipment-image,
html body .crane-image {
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 60%, #ffffff 0%, #f1f4f7 70%, #e9eef2 100%);
    padding: 12px;
}
html body .featured-image img,
html body .equipment-image img,
html body .crane-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;          /* whole crane visible, never cropped */
    object-position: center;
    transform: scale(1);
    transform-origin: center;
    transition: transform .6s var(--ease);
}
html body .featured-card:hover .featured-image img,
html body .equipment-card:hover .equipment-image img,
html body .crane-card:hover .crane-image img {
    transform: scale(1.05);       /* stays inside the 12px frame padding */
}

/* subtle shine sweep across the image on hover */
html body .featured-image::after,
html body .equipment-image::after,
html body .crane-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.45) 50%, transparent 65%);
    transform: translateX(-120%);
    transition: transform .9s var(--ease);
    pointer-events: none;
}
html body .featured-card:hover .featured-image::after,
html body .equipment-card:hover .equipment-image::after,
html body .crane-card:hover .crane-image::after { transform: translateX(120%); }

/* keep badges above the image */
html body .featured-badge,
html body .multi-brands-badge { z-index: 3; }

@media (max-width: 767.98px) {
    html body .featured-image,
    html body .crane-image,
    html body .equipment-image { height: 220px; }
}

/* Crane detail page: whole crane in the main photo */
html body #mainImage {
    width: 100% !important;
    height: 450px !important;
    object-fit: contain !important;
    background: radial-gradient(ellipse at 50% 60%, #ffffff 0%, #f1f4f7 70%, #e9eef2 100%);
    padding: 12px;
    border-radius: var(--radius) !important;
    transition: opacity .25s var(--ease);
}
html body #mainImage.is-switching { opacity: .35; }
@media (max-width: 767.98px) {
    html body #mainImage { height: 300px !important; }
}
html body .gallery-thumb {
    border-radius: 10px !important;
    border: 2px solid transparent;
    object-fit: contain !important;
    background: #f1f4f7;
    padding: 4px;
    transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
html body .gallery-thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); opacity: 1; }
html body .gallery-thumb.is-active { border-color: var(--brand-green); }

/* ---------------------------------------------------------------
   Buttons, forms, general smoothness
   --------------------------------------------------------------- */
html body .btn {
    border-radius: 10px;
    font-weight: 600;
    transition: transform .2s var(--ease), box-shadow .25s var(--ease), background-color .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
html body .btn:hover { transform: translateY(-2px); }
html body .btn:active { transform: translateY(0); }
html body .btn-danger:hover  { box-shadow: 0 8px 20px rgba(220, 53, 69, .28); }
html body .btn-primary:hover { box-shadow: 0 8px 20px rgba(13, 110, 253, .28); }
html body .btn-success:hover { box-shadow: 0 8px 20px rgba(25, 135, 84, .28); }

html body .form-control,
html body .form-select {
    border-radius: 10px;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
html body .form-control:focus,
html body .form-select:focus {
    border-color: var(--brand-green-2);
    box-shadow: 0 0 0 .2rem rgba(27, 76, 36, .15);
}

html body .modal.fade .modal-dialog { transition: transform .35s var(--ease), opacity .35s var(--ease); }

html body a { transition: color .2s var(--ease); }

html body :focus-visible { outline: 3px solid rgba(27, 76, 36, .45); outline-offset: 2px; }

/* WhatsApp button: soft pulse */
html body .whatsapp-btn {
    width: 56px;
    height: 56px;
    font-size: 28px;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
    animation: waPulse 2.8s ease-out infinite;
}
html body .whatsapp-btn:hover { transform: scale(1.08); color: #fff; }
@keyframes waPulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, .55), 0 4px 10px rgba(0,0,0,.2); }
    70%  { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0), 0 4px 10px rgba(0,0,0,.2); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0), 0 4px 10px rgba(0,0,0,.2); }
}

/* Footer links */
html body footer a { transition: opacity .2s var(--ease), padding .25s var(--ease); }
html body footer .Quick-Links a:hover { opacity: .85; padding-inline-start: 4px; }

/* ---------------------------------------------------------------
   Reveal-on-scroll (only active when enhance.js is running)
   --------------------------------------------------------------- */
html.js-reveal .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
    transition-delay: var(--reveal-delay, 0s);
}
html.js-reveal .reveal.is-visible { opacity: 1; transform: none; }

/* ---------------------------------------------------------------
   Respect users who prefer less motion
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    html body *, html body *::before, html body *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    html.js-reveal .reveal { opacity: 1; transform: none; }
}

/* Back-to-top button (created by main.js): keep it on the side opposite WhatsApp */
html body .back-to-top {
    width: 46px !important;
    height: 46px !important;
    bottom: 24px !important;
    background: var(--brand-green) !important;
    font-size: 18px !important;
}
html body.lang-rtl .back-to-top { left: auto !important; right: 24px !important; }
html body.lang-ltr .back-to-top { right: auto !important; left: 24px !important; }
html body .back-to-top:hover { transform: translateY(-3px); }

/* old style.css draws an underline under every link in <nav>; keep it only on menu links */
html body #header .lang-switch::after,
html body #header .navbar-brand::after { display: none; content: none; }

/* Menu button is for phones/tablets only */
@media (min-width: 992px) {
    html body #header .navbar-toggler { display: none !important; }
}
