:root {
    --ink: #183b34;
    --muted: #6d7773;
    --paper: #f8f5ef;
    --line: #dedbd2;
    --accent: #d96d48;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "DM Sans", "Noto Kufi Arabic", sans-serif;
}

.header {
    height: 76px;
    max-width: 1200px;
    margin: auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--ink);
    text-decoration: none;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 2px;
}

.brand span {
    font-weight: 400;
}

.brand-logo {
    max-height: 34px;
    max-width: 180px;
    width: auto;
    display: block;
    object-fit: contain;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.text-btn,
.admin-btn {
    background: none;
    border: 0;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}

.admin-btn {
    border: 1px solid var(--ink);
    border-radius: 99px;
    padding: 9px 14px;
    font-size: 13px;
}

/* =========================
   HERO
   ========================= */

.hero {
    max-width: 1200px;
    margin: auto;
    padding: 100px 28px 78px;
}

.hero>p:first-child {
    font-size: 11px;
    letter-spacing: 2px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--accent);
}

h1 {
    font-size: clamp(48px, 8vw, 94px);
    line-height: 0.96;
    letter-spacing: -4px;
    margin: 0;
    max-width: 650px;
    font-weight: 600;
}

h1 em {
    font-family: Georgia, serif;
    font-weight: 400;
}

.hero-copy {
    color: var(--muted);
    line-height: 1.7;
    max-width: 460px;
    margin: 24px 0 0;
}

/* =========================
   PRODUCTS
   ========================= */

.products-wrap {
    max-width: 1200px;
    padding: 0 28px 100px;
    margin: auto;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    border-bottom: 1px solid var(--ink);
    padding-bottom: 14px;
    margin-bottom: 26px;
}

.section-heading h2 {
    font-size: 24px;
    margin: 0;
}

.section-heading span {
    font-size: 13px;
    color: var(--muted);
}

.products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px 20px;
}

.card {
    cursor: pointer;
    position: relative;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #e5e1d8;
    display: block;
}

.card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #e5e1d8;
}

.card-media .card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sold {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);

    background: rgba(24, 59, 52, 0.92);
    color: white;

    padding: 14px 12px;

    text-align: center;

    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;

    z-index: 5;
    pointer-events: none;
}

.card-body {
    padding: 13px 2px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.card-title {
    font-weight: 600;
}

.price {
    font-weight: 600;
    white-space: nowrap;
}

.empty {
    text-align: center;
    padding: 60px 0;
    color: var(--muted);
}

.empty h3 {
    color: var(--ink);
    font-size: 22px;
}

.hidden {
    display: none;
}

/* =========================
   FOOTER
   ========================= */

footer {
    border-top: 1px solid var(--line);
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
}

#socialLinks { display: flex; gap: 12px; }
#socialLinks a { color: inherit; text-decoration: none; }
#socialLinks a:hover { text-decoration: underline; }

/* =========================
   PRODUCT DIALOG / MODAL
   ========================= */

dialog {
    border: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 20px 60px #0005;

    width: min(950px, 94vw);
    max-width: 94vw;
    max-height: 92vh;

    overflow: auto;
}

dialog::backdrop {
    background: #183b3480;
}

.close {
    position: absolute;
    z-index: 10;
    top: 14px;
    right: 14px;
    border: 0;
    background: white;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 28px;
    line-height: 30px;
    cursor: pointer;
    color: var(--ink);
}

.product-dialog {
    width: 900px;
    max-width: 94vw;
}

/* Main product detail layout */

.detail {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    min-height: 500px;
}

/* =========================
   PRODUCT GALLERY
   ========================= */

.gallery {
    background: #e5e1d8;

    /* Important: keeps images inside gallery */
    overflow: hidden;

    min-width: 0;
}

/*
   Main product image

   contain = show the complete image
   instead of cropping it.
*/

.main-image {
    width: 100%;
    height: 430px;
    object-fit: contain;
    object-position: center;
    display: block;
    background: #e5e1d8;

    /* Prevent image from escaping */
    max-width: 100%;
    max-height: 430px;
}

/* Thumbnail container */

.thumbs {
    display: flex;
    gap: 8px;
    padding: 10px;
    overflow-x: auto;
    overflow-y: hidden;

    /* Keep thumbnails inside modal */
    max-width: 100%;
}

/* Thumbnail */

.thumb {
    width: 58px;
    height: 70px;
    min-width: 58px;
    object-fit: cover;
    object-position: center;
    border: 2px solid transparent;
    cursor: pointer;
    display: block;
}

.thumb.active {
    border-color: var(--ink);
}

/* =========================
   PRODUCT DETAIL TEXT
   ========================= */

.detail-copy {
    padding: 55px 36px;
    min-width: 0;
}

.detail-copy h2 {
    font-size: 32px;
    line-height: 1.1;
    margin: 0 0 12px;
}

.detail-price {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

.description {
    line-height: 1.7;
    color: var(--muted);
    white-space: pre-line;
}

.whatsapp {
    background: #1e8d59;
    color: white;
    text-decoration: none;
    display: inline-flex;
    margin-top: 32px;
    padding: 14px 20px;
    border-radius: 4px;
    font-weight: 700;
}

.sold-detail {
    color: var(--accent);
    font-weight: bold;
    margin-top: 28px;
}

/* =========================
   ADMIN DIALOG
   ========================= */

.admin-dialog {
    width: min(760px, 94vw);
}

.admin-panel {
    padding: 46px 34px;
}

.admin-panel h2 {
    margin: 0 0 26px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.admin-panel label {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.admin-panel input,
.admin-panel textarea {
    margin-top: 7px;
    width: 100%;
    font: inherit;
    border: 1px solid var(--line);
    background: white;
    padding: 11px;
    border-radius: 4px;
}

.admin-panel textarea {
    min-height: 80px;
    resize: vertical;
}

.full {
    grid-column: 1 / -1;
}

.check {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.check input {
    width: auto !important;
    margin: 0 !important;
}

.submit {
    margin-top: 20px;
    background: var(--ink);
    color: white;
    border: 0;
    padding: 13px 19px;
    border-radius: 4px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

/* =========================
   ADMIN PRODUCT LIST
   ========================= */

.manage-list {
    margin-top: 38px;
    border-top: 1px solid var(--line);
    padding-top: 20px;
}

.manage-row {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
}

.manage-row img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    display: block;
}

.manage-row span {
    flex: 1;
}

.delete {
    border: 0;
    background: none;
    color: #b74a35;
    cursor: pointer;
    font: inherit;
}

.edit {
    border: 1px solid var(--ink);
    background: none;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    padding: 6px 10px;
    border-radius: 4px;
}

.hint {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

/* =========================
   RTL
   ========================= */

.rtl {
    font-family: "Noto Kufi Arabic", "DM Sans", sans-serif;
}

.rtl h1 {
    letter-spacing: -2px;
}

.rtl .close {
    right: auto;
    left: 14px;
}

.rtl .brand-logo {
    margin-left: auto;
    margin-right: 0;
}



/* =========================
   MOBILE
   ========================= */

@media (max-width: 680px) {

    .header {
        padding: 0 16px;
    }

    .hero {
        padding: 68px 20px 55px;
    }

    .products-wrap {
        padding: 0 16px 60px;
    }

    .products {
        grid-template-columns: repeat(2, 1fr);
        gap: 23px 12px;
    }

    .card-body {
        display: block;
    }

    .price {
        margin-top: 5px;
    }

    /*
       On mobile the detail becomes one column.
    */

    .detail {
        grid-template-columns: 1fr;
    }

        .product-dialog {
            width: 94vw;
            max-width: 94vw;
            max-height: 94vh;
        }
    
        .detail {
            display: grid;
            grid-template-columns: 1fr;
            min-height: auto;
        }
    
        .gallery {
            width: 100%;
            max-width: 100%;
            overflow: hidden;
        }
    
        .main-image {
            width: 100%;
            height: min(58vh, 460px);
            max-width: 100%;
            max-height: 58vh;
            object-fit: contain;
            object-position: center;
        }
    
        .thumbs {
            width: 100%;
            max-width: 100%;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
        }
    
        .detail-copy {
            padding: 26px 20px 30px;
        }
    
        .detail-copy h2 {
            font-size: 27px;
        }
    
        .detail-price {
            font-size: 19px;
        }
    
        .whatsapp {
            width: 100%;
            justify-content: center;
            text-align: center;
        }
    
        .close {
            top: 10px;
            right: 10px;
            width: 36px;
            height: 36px;
            font-size: 24px;
        }

    /*
       Keep the main image completely inside
       the mobile modal.
    */

    .gallery {
        width: 100%;
        overflow: hidden;
    }

    .main-image {
        width: 100%;
        height: min(55vh, 430px);
        max-height: 55vh;
        object-fit: contain;
    }

    .thumbs {
        width: 100%;
        max-width: 100%;
    }

    .detail-copy {
        padding: 30px 24px;
    }

    .admin-panel {
        padding: 45px 20px 25px;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .full {
        grid-column: auto;
    }

    footer {
        padding: 20px 16px;
        gap: 10px;
        flex-wrap: wrap;
    }

    h1 {
        letter-spacing: -2px;
    }

        .rtl .close {
            right: auto;
            left: 10px;
        }
}
