/*
  Al-Iman Al-Oula — Mobile-First CSS
  Theme: Premium Emerald & Gold
*/

:root {
    --primary:       #1a3a2e;
    --primary-mid:   #2e6b50;
    --primary-light: #4caf82;
    --gold:          #c8a44e;
    --gold-light:    #e8c97a;
    --gold-dark:     #9e7c2a;

    --text-main:  #1c2b24;
    --text-muted: #5a7060;

    --bg-main:     #ffffff;
    --bg-soft:     #f4f7f5;
    --bg-dark:     #0f2319;
    --bg-products: #f9faf9;

    --border: #d6e5db;

    --shadow-sm: 0 4px 10px rgba(26,58,46,.07);
    --shadow-md: 0 10px 30px rgba(26,58,46,.12);
    --shadow-lg: 0 20px 50px rgba(26,58,46,.15);
    --transition: all .35s cubic-bezier(.25,.8,.25,1);
}

/* =========================================
   Reset & Base
========================================= */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html {
    scroll-behavior: smooth;
    overflow-x: hidden;   /* Safari needs this on html */
}

body {
    font-family: 'Tajawal', sans-serif;
    color: var(--text-main);
    background: var(--bg-main);
    line-height: 1.7;
    overflow-x: hidden;
}

a { text-decoration:none; color:inherit; transition: var(--transition); }
ul { list-style:none; }
img { max-width:100%; height:auto; display:block; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.section { padding: 56px 0; }
.bg-products { background: var(--bg-products); }
.ltr-text { direction:ltr; unicode-bidi:embed; }

h1,h2,h3,h4,h5,h6 { color:var(--primary); font-weight:700; line-height:1.3; }

/* =========================================
   Typography helpers
========================================= */
.section-tag {
    display: inline-block;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    color: var(--primary);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.section-heading {
    text-align: center;
    margin-bottom: 40px;
}

.section-heading h2 {
    font-size: clamp(1.6rem, 5vw, 2.6rem);
    color: var(--primary);
}

.section-heading h2 span { color: var(--primary-light); }

.heading-line {
    width: 50px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-light), var(--gold));
    margin: 12px auto 16px;
    border-radius: 2px;
}

.section-heading p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 560px;
    margin: 0 auto;
}

/* =========================================
   Buttons
========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: 'Tajawal', sans-serif;
    min-height: 48px;  /* Touch target */
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-mid), var(--primary-light));
    color: white;
    box-shadow: 0 6px 20px rgba(76,175,130,.35);
}

.btn-primary:active { transform: scale(.97); }

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,.6);
}

.btn-outline:active { background: rgba(255,255,255,.1); }

/* =========================================
   Header — Mobile First
========================================= */
.header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.header.scrolled {
    box-shadow: var(--shadow-md);
    border-color: transparent;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    transition: var(--transition);
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0;
}

.logo h1 span { color: var(--gold-dark); }

/* Desktop nav — hidden on mobile */
.nav {
    position: fixed;
    top: 64px; left: 0;
    width: 100%;
    background: white;
    padding: 20px 16px;
    box-shadow: var(--shadow-md);
    clip-path: circle(0% at 90% 0);
    transition: clip-path .45s ease-in-out;
    z-index: 999;
}

.nav.open { clip-path: circle(150% at 90% 0); }

.nav-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.nav-link {
    font-weight: 600;
    color: var(--text-muted);
    padding: 12px 20px;
    border-radius: 8px;
    width: 100%;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    background: rgba(76,175,130,.1);
}

.mobile-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 1001;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.mobile-toggle span {
    width: 26px;
    height: 2.5px;
    background: var(--primary);
    border-radius: 3px;
    transition: var(--transition);
    display: block;
}

/* =========================================
   Hero — Mobile First
========================================= */
.hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    background: linear-gradient(160deg, #0f2319 0%, #1a3a2e 60%, #2e6b50 100%);
    overflow: hidden;
    padding-top: 64px;
}

/* Decorative blobs — clipped to hero */
.hero::before {
    content: '';
    position: absolute;
    top: -10%; left: -10%;
    width: 60vw; height: 60vw;
    max-width: 500px; max-height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200,164,78,.07) 0%, transparent 70%);
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -10%; right: -10%;
    width: 60vw; height: 60vw;
    max-width: 500px; max-height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(76,175,130,.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 36px;
    z-index: 2;
    position: relative;
    width: 100%;
    padding: 48px 20px 60px;
}

.hero-content { width: 100%; }

.hero-title {
    font-size: clamp(2rem, 8vw, 3.8rem);
    font-weight: 800;
    color: white;
    margin-bottom: 16px;
    line-height: 1.15;
}

.hero-subtitle {
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    color: rgba(255,255,255,.75);
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.hero-actions .btn { width: 100%; max-width: 280px; }

/* Hero Visual — single image on mobile */
.hero-visual {
    width: 100%;
    max-width: 320px;
    flex-shrink: 0;
}

/* Mobile: show only the front card as a simple floating image */
.hero-card-stack {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg), 0 0 0 3px rgba(200,164,78,.5);
    animation: float-card 6s ease-in-out infinite; /* animate the whole card */
}

.stack-img {
    position: absolute;
    border-radius: 16px;
    background-size: cover;
    background-position: center;
    border: 3px solid rgba(255,255,255,.15);
}

/* On mobile: hide back/mid cards, front card fills container */
.stack-img-back,
.stack-img-mid { display: none; }

.stack-img-front {
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    box-shadow: none;
    animation: none; /* animation is on the parent container */
}

.hero-scroll-hint { display: none; }

@keyframes float-card {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

/* =========================================
   Stats Bar — Mobile First
========================================= */
.stats-bar {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-mid) 100%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.stat-item {
    text-align: center;
    padding: 24px 12px;
    border-left: 1px solid rgba(255,255,255,.1);
}

.stat-item:last-child { border-left: none; }

.stat-item strong {
    display: block;
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: 800;
    color: var(--gold-light);
    margin-bottom: 4px;
}

.stat-item p {
    color: rgba(255,255,255,.7);
    font-size: clamp(.7rem, 2.5vw, .9rem);
    margin: 0;
}

/* =========================================
   About Section — Mobile First
========================================= */
.about-grid {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* Mobile: simple stacked images */
.about-image { width: 100%; }

.about-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 16px;
    overflow: hidden;
}

.about-img-main {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    position: static;
    border: none;
}

/* Hide second image and badge on mobile */
.about-img-sub,
.about-badge { display: none; }

.about-text h3 {
    font-size: 1.5rem;
    margin-bottom: 14px;
    color: var(--primary);
}

.about-text > p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.85;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-soft);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.info-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, var(--primary-mid), var(--primary-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.info-body h4 {
    font-size: .88rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}

.info-body p {
    font-size: .92rem;
    color: var(--text-muted);
    margin: 0;
}

/* =========================================
   Products Section — Mobile First
========================================= */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.product-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    aspect-ratio: 1;
}

.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

/* Always show overlay on mobile (no hover) */
.product-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15,35,25,.8) 0%, transparent 55%);
    display: flex;
    align-items: flex-end;
    padding: 12px;
    opacity: 1;
    transition: var(--transition);
}

.product-overlay span {
    color: white;
    font-weight: 700;
    font-size: .8rem;
    background: rgba(200,164,78,.8);
    padding: 3px 10px;
    border-radius: 20px;
}

/* =========================================
   Contact Section — Mobile First
========================================= */
.contact-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.contact-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    transition: var(--transition);
}

.contact-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-mid));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.contact-icon svg { width: 24px; height: 24px; }

.contact-card h3 {
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 1.1rem;
}

.contact-card p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 4px;
}

.contact-card a {
    color: var(--primary-light);
    font-weight: 600;
}

/* =========================================
   Footer — Mobile First
========================================= */
.footer {
    background: var(--bg-dark);
    color: rgba(255,255,255,.8);
    padding: 48px 0 20px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-bottom: 36px;
}

.footer-brand h2 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.footer-brand h2 span { color: var(--gold-light); }
.footer-brand p { color: rgba(255,255,255,.55); line-height: 1.8; }

.footer-nav h3,
.footer-info h3 {
    color: white;
    margin-bottom: 14px;
    font-size: .95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.footer-nav ul,
.footer-info ul {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-nav a { color: rgba(255,255,255,.55); }
.footer-nav a:hover { color: var(--gold-light); }
.footer-info li { color: rgba(255,255,255,.55); font-size: .88rem; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.08);
    padding-top: 20px;
    text-align: center;
    color: rgba(255,255,255,.35);
    font-size: .85rem;
}

/* =========================================
   Animations
========================================= */
.fade-in-up,
.fade-in-right,
.fade-in-left {
    opacity: 0;
    transition: opacity .65s ease, transform .65s ease;
}

/* Mobile: all directions use translateY to avoid any horizontal overflow */
.fade-in-up    { transform: translateY(28px); }
.fade-in-right { transform: translateY(28px); }
.fade-in-left  { transform: translateY(28px); }

.is-visible { opacity:1; transform:translate(0,0); }

/* =========================================
   Tablet — 640px+
========================================= */
@media (min-width: 640px) {
    .hero-actions { flex-direction: row; }
    .hero-actions .btn { width: auto; }

    .contact-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    /* Show two-panel footer */
    .footer-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .footer-brand { grid-column: 1 / -1; }
}

/* =========================================
   Desktop — 900px+
========================================= */
@media (min-width: 900px) {
    .container { padding: 0 24px; }
    .section { padding: 90px 0; }

    /* Header */
    .header-container { height: 76px; }
    .header.scrolled .header-container { height: 66px; }
    .logo h1 { font-size: 1.7rem; }

    .mobile-toggle { display: none; }

    .nav {
        position: static;
        background: transparent;
        padding: 0;
        box-shadow: none;
        clip-path: none !important;
        width: auto;
        z-index: auto;
    }

    .nav-list {
        flex-direction: row;
        gap: 6px;
    }

    .nav-link {
        padding: 8px 14px;
        width: auto;
        min-height: auto;
    }

    /* Hero */
    .hero { padding-top: 76px; }

    .hero-container {
        flex-direction: row;
        text-align: right;
        justify-content: space-between;
        padding: 60px 24px;
        gap: 60px;
    }

    .hero-content { flex: 1; }

    .hero-actions {
        flex-direction: row;
        justify-content: flex-start;
    }

    .hero-actions .btn { width: auto; }

    .hero-subtitle { margin-left: 0; margin-right: 0; }

    /* Restore card stack on desktop */
    .hero-visual {
        flex: 1;
        max-width: none;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .hero-card-stack {
        width: 380px;
        height: 460px;
        aspect-ratio: auto;
        border-radius: 0;
        overflow: visible;
        border: none;
        box-shadow: none;
    }

    .stack-img-back,
    .stack-img-mid { display: block; }

    .stack-img-back {
        width: 240px;
        height: 300px;
        top: 0; left: 0;
        transform: rotate(-8deg);
        opacity: .5;
        filter: brightness(.7);
        inset: auto;
    }

    .stack-img-mid {
        width: 250px;
        height: 320px;
        top: 30px; left: 60px;
        transform: rotate(-2deg);
        opacity: .75;
        filter: brightness(.85);
        inset: auto;
    }

    .stack-img-front {
        width: 260px;
        height: 340px;
        inset: auto;
        bottom: 0; right: 0;
        border: 4px solid rgba(200,164,78,.5);
        box-shadow: var(--shadow-lg), 0 0 0 1px rgba(200,164,78,.2);
    }

    .hero-scroll-hint {
        display: block;
        position: absolute;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 3;
    }

    .hero-scroll-hint span {
        display: block;
        width: 24px;
        height: 40px;
        border: 2px solid rgba(255,255,255,.3);
        border-radius: 12px;
        position: relative;
    }

    .hero-scroll-hint span::after {
        content: '';
        position: absolute;
        width: 4px;
        height: 8px;
        background: var(--gold-light);
        border-radius: 2px;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        animation: scroll-dot 2s ease-in-out infinite;
    }

    @keyframes scroll-dot {
        0%   { top: 6px; opacity: 1; }
        80%  { top: 20px; opacity: 0; }
        100% { top: 6px; opacity: 0; }
    }

    /* Stats */
    .stat-item { padding: 36px 20px; }

    /* About */
    .about-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 70px;
        align-items: center;
    }

    .about-image-wrap {
        aspect-ratio: auto;
        height: 480px;
        overflow: visible;
        border-radius: 0;
    }

    .about-img-main {
        width: 75%;
        height: 320px;
        border-radius: 16px;
        position: absolute;
        top: 0; right: 0;
        border: 5px solid white;
    }

    .about-img-sub {
        display: block;
        width: 65%;
        height: 260px;
        object-fit: cover;
        border-radius: 16px;
        box-shadow: var(--shadow-lg);
        position: absolute;
        bottom: 30px; left: 0;
        border: 5px solid white;
        z-index: 2;
    }

    .about-badge {
        display: block;
        position: absolute;
        top: 50%; left: 50%;
        transform: translate(-50%, -50%);
        background: linear-gradient(135deg, var(--primary), var(--primary-mid));
        color: white;
        padding: 14px 22px;
        border-radius: 50px;
        text-align: center;
        box-shadow: var(--shadow-md);
        z-index: 3;
        white-space: nowrap;
        font-size: .9rem;
        font-weight: 700;
    }

    .info-row:hover {
        border-color: var(--primary-light);
        background: white;
        transform: translateX(-4px);
        box-shadow: var(--shadow-sm);
    }

    /* Products */
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .product-overlay { opacity: 0; }
    .product-card:hover img { transform: scale(1.07); }
    .product-card:hover .product-overlay { opacity: 1; }

    /* Contact */
    .contact-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px;
    }

    .contact-card:hover {
        transform: translateY(-6px);
        box-shadow: var(--shadow-md);
        border-color: var(--primary-light);
        background: white;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 50px;
    }

    .footer-brand { grid-column: auto; }

    .footer-nav a:hover { padding-right: 6px; }

    /* Restore horizontal slide-in animations on desktop */
    .fade-in-right { transform: translateX(28px); }
    .fade-in-left  { transform: translateX(-28px); }

    /* Buttons hover */
    .btn-primary:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 30px rgba(76,175,130,.5);
        color: white;
    }

    .btn-outline:hover {
        background: rgba(255,255,255,.15);
        border-color: white;
        transform: translateY(-3px);
    }
}
