/* ================================================================
CHIPS PRODUCTION PAGE - Figma Spec Implementation
================================================================ */

/* ========== BASE CONTAINER ========== */
.chips-production-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background: var(--c-bg-gradient);
    overflow: hidden;
}

.chips-bg { position: absolute; inset: 0; z-index: 0; }
.chips-main-wrapper {
    position: relative;
    width: 100%;
    max-width: min(1280px, 100%);
    margin: 0 auto;
    padding-inline: clamp(1rem, 4vw, 2.75rem);
    z-index: 1;
    box-sizing: border-box;
}

/* ========== PAGE TITLE ========== */
.chips-page-title { text-align: center; margin: 0 auto 40px; position: relative; }
.chips-page-title-text {
    font-family: var(--font-latin);
    font-weight: 400; font-size: 60px; line-height: 100%;
    color: rgba(255, 255, 255, 1); margin: 0; text-align: center;
}
.chips-title-line {
    display: block; width: 529px; height: 14px;
    background: rgba(212, 175, 55, 1); margin: 20px auto 0; border-radius: 2px;
}

/* ========== GRID TOGGLE: Show/Hide based on viewport ========== */
.chips-grid-desktop { 
    display: block; 
    margin-bottom: 120px;
}
.chips-grid-mobile { display: none; }

@media (max-width: 767.98px) {
    .chips-grid-desktop { 
        display: none;
    }
    .chips-grid-mobile { 
        display: block;
        margin-bottom: 40px; 
    }
}

/* ========== ROW CONTAINER (Bordered Group) - DESKTOP ========== */
.chips-row-container {
    position: relative;
    width: 96%;
    /* max-width: 1230px; */
    height: 479px;
    margin: 40px auto 0;
    border-radius: 0 200px 0 200px;
    border-top: 2px solid var(--c-white);
    border-bottom: 2px solid var(--c-white);
    display: grid;
    align-items: center;
    overflow: hidden;
}

/* [dir="rtl"] .chips-row-container { border-radius: 200px 0 200px 0; } */

/* Desktop: 3 cards per row */
.chips-grid-desktop .chips-row-container {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr;
    width: 95%;
}

/* Desktop: last (or only) row with 1–2 cards — avoid empty grid columns; center cards */
.chips-grid-desktop .chips-row-container--partial-desktop {
    grid-template-columns: repeat(var(--chips-partial-cols, 1), auto);
    justify-content: center;
    column-gap: clamp(28px, 4vw, 64px);
    width: min(96%, 1240px);
}

.chips-grid-desktop .chips-row-container--partial-desktop .chips-card-link {
    width: auto;
    max-width: 100%;
}

/* Mobile: single card in a row — center instead of leaving one empty column */
.chips-grid-mobile .chips-row-container--partial-mobile {
    grid-template-columns: 1fr;
    justify-items: center;
}

/* Mobile: 2 cards per row */
.chips-grid-mobile .chips-row-container {
    width: 300px;
    height: auto;
    min-height: 128px;
    margin: 30px auto 0;
    border-radius: 0 15px 0 15px;
    border-right: 1px solid var(--c-white);
    border-left : 1px solid var(--c-white);
    border-top: none; border-bottom: none;
    background: rgba(255, 255, 255, 0.1);
    padding: 0 15px;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: auto;
    gap: 15px 10px;
    align-items: start;
    overflow: visible;
}

/* [dir="rtl"] .chips-grid-mobile .chips-row-container { border-radius: 10px 0 10px 0; } */

/* Clickable wrapper */
.chips-card-link { 
    display: block; 
    text-decoration: none; 
    color: inherit;
}
.chips-card-link:hover .chips-card { 
    opacity: 1; 
    transform: translateY(-4px);
}

/* ========== CHIPS CARD - DESKTOP ========== */
.chips-card {
    position: relative;
    background: transparent;
    overflow: hidden;
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 25px;
}

.chips-card-image-wrapper {
    position: relative;
    border-radius: 0 80px 0 80px;
    border: 2px solid var(--c-white);
    overflow: hidden;
    margin-bottom: 20px;
}
/* [dir="rtl"] .chips-card-image-wrapper { border-radius: 80px 0 80px 0; } */

.chips-card-image-wrapper img {
    width: 360px; height: 230px; object-fit: cover;
    opacity: 0.9; transition: transform 0.3s ease, opacity 0.3s ease;
}
.chips-card-link:hover .chips-card-image-wrapper img {
    transform: scale(1.05); opacity: 1;
}

.chips-card-text {
    font-family: var(--font-arabic); font-weight: 400;
    font-size: 24px; line-height: 28.8px;
    text-align: center; color: var(--c-white); margin: 0;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
}

.chips-card-date {
    font-size: 18px;
    line-height: 22px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    margin-top: 6px;
}

/* ========== TABLET (≤1023px) ========== */
@media (max-width: 1023.98px) {
    .chips-grid-desktop .chips-row-container {
        width: min(90vw, 900px);
        height: 400px;
        border-radius: 0 150px 0 150px;
        padding: 30px;
        gap: 30px;
    }
    /* [dir="rtl"] .chips-grid-desktop .chips-row-container { border-radius: 150px 0 150px 0; } */
    
    .chips-card { 
        padding: 20px; 
    }
    .chips-card-image-wrapper {
        width: 100%; max-width: 250px; height: 180px;
        border-radius: 0 60px 0 60px;
    }
    .chips-card-image-wrapper img { 
        width: 100%;
        height: 100%; 
    }
    .chips-card-text { 
        font-size: 20px; 
        line-height: 24px; 
    }
}

/* ========== MOBILE CARD STYLES (applies to mobile grid only) ========== */
@media (max-width: 767.98px) {
    .chips-production-page { /* padding-top: 80px; */ }
    .chips-main-wrapper { 
        padding: 0 10px; 
    }
    .chips-page-title-text { 
        font-size: 40px; 
    }
    .chips-title-line { 
        width: 300px; 
        height: 8px; 
    }
    
    .chips-grid-mobile .chips-card {
        padding: 8px; opacity: 1;
        width: 100%; max-width: 130px; margin: 0 auto;
    }
    .chips-grid-mobile .chips-card-image-wrapper {
        width: 103px; height: 65px;
        margin: 8px auto 4px;
        border-radius: 0 10px 0 10px;
        border: 2px solid var(--c-white);
    }
    /* [dir="rtl"] .chips-grid-mobile .chips-card-image-wrapper { border-radius: 10px 0 10px 0; } */
    .chips-grid-mobile .chips-card-image-wrapper img { 
        width: 100%; height: 100%; 
    }
    
    .chips-grid-mobile .chips-card-text {
        font-family: var(--font-arabic); font-weight: 400;
        font-size: 8px; line-height: 13px;
        text-align: center; -webkit-line-clamp: 3;
    }

    .chips-grid-mobile .chips-card-date {
        font-size: 7px;
        line-height: 11px;
        margin-top: 2px;
    }
    
    /* Disable hover on mobile */
    .chips-card-link:hover .chips-card { 
        transform: none; 
    }
    .chips-card-link:hover .chips-card-image-wrapper img { 
        transform: none; 
    }
}

/* ========== SMALL MOBILE (≤319px) ========== */
@media (max-width: 319.98px) {
    .chips-grid-mobile .chips-row-container {
        width: calc(100vw - 20px);
        max-width: 300px;
        gap: 12px 8px;
        padding: 12px;
    }
    .chips-grid-mobile .chips-card-text { 
        font-size: 7px;
        line-height: 12px; 
    }
    .chips-grid-mobile .chips-card-image-wrapper { 
        width: 90px; 
        height: 55px; 
    }
}

/* ========== LOAD MORE BUTTON ========== */
.chips-load-more {
    /* Dimensions */
    width: 329px;
    height: 96px;
    
    /* Position: bottom-left of main wrapper */
    position: relative;
    margin: 20px auto 40px;
    margin-left: 217px; /* Align with your spec */
    
    /* Border styling */
    border-right: 3px solid rgba(255, 255, 255, 0.1);
    border-bottom: 3px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px 0 50px 0;
    border-image-slice: 1;
    
    /* Background & opacity */
    /* background: rgba(255, 255, 255, 0.1); */
    opacity: 1; /* Container opacity, text stays visible */
    
    /* Layout */
    display: flex;
    align-items: center;
    justify-content: center; /* Text on right for RTL */
    gap: 12px;
    padding: 10px;
    padding-right: 24px;
    
    /* Cursor & transition */
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
    
    /* Reset button defaults */
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Hover effect */
.chips-load-more:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(-4px);
}

.chips-load-more:active {
    transform: translateX(0);
}

/* Button text */
.chips-load-more span {
    color: rgba(255, 229, 204, 1);
    font-family: 'Tajawal', var(--font-arabic);
    font-weight: 700;
    font-style: normal;
    font-size: 40px;
    line-height: 100%;
    letter-spacing: 0;
    text-align: right;
    white-space: nowrap;
}

/* RTL support */
/* [dir="rtl"] .chips-load-more {
    margin-left: auto;
    margin-right: 217px;
    justify-content: flex-start;
    padding-right: 10px;
    padding-left: 24px;
} */
/* 
[dir="rtl"] .chips-load-more span {
    text-align: left;
} */

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 767.98px) {
    .chips-load-more {
        /* Center on mobile for better UX */
        margin: 40px auto;
        margin-left: auto;
        margin-right: auto;
        width: 120px;
        height: 40px;
        border-radius: 40px;
        justify-content: center;
        padding: 10px 20px;
    }
    
    .chips-load-more span {
        font-size: 14px;
    }
    
    /* [dir="rtl"] .chips-load-more {
        margin-right: auto;
    } */
}

@media (max-width: 319.98px) {
    .chips-load-more {
        width: 240px;
        height: 70px;
    }
    
    .chips-load-more span {
        font-size: 28px;
    }
}

/* ========== HIDDEN STATE ========== */
.chips-load-more.hidden {
    display: none !important;
}