/**
 * Single Blog Post Styles
 *
 * Header: simple title + meta strip (no hero)
 * Image:  capped at 480px wide, 1.9:1 aspect ratio
 *
 * Body layout (RTL, two columns):
 *   right (.blog-main-content) → image → categories → content
 *   left  (.blog-tags-sidebar) → tags stacked vertically
 */

/* ── Navbar variant: show with-search, hide default ─── */

.single-post .topnav:not(.topnav--with-search) {
    display: none !important;
}

.single-post .topnav--with-search {
    display: flex !important;
}

/* ── Page shell ──────────────────────────────────────── */

.blog-single-main {
    width: 100%;
    background-color: #F8F9FA;
}

/* ── Article ─────────────────────────────────────────── */

.blog-single-article {
    padding-top: 120px;
    padding-bottom: 100px;
}

.blog-single-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    box-sizing: border-box;
}

/* ── Two-column wrapper ───────────────────────────────── */
/*
 * direction: rtl → column 1 is on the RIGHT, column 2 on the LEFT.
 * grid-template-columns: 1fr 220px
 *   col 1 (RIGHT, flexible)  → .blog-main-content
 *   col 2 (LEFT,  220px)     → .blog-tags-sidebar
 */
.blog-single-wrapper {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 48px;
    align-items: start;
}

/* ── Right column: main content ──────────────────────── */

.blog-main-content {
    min-width: 0; /* prevent grid blowout */
}

/* ── Post title ───────────────────────────────────────── */

.blog-single-title {
    font-family: Almarai, Arial, sans-serif;
    font-size: 36px;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.4;
    text-align: start;
    margin: 0 0 16px;
    max-width: 768px;
}

/* ── Author / date meta pills ────────────────────────── */

.blog-single-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: row-reverse;
    justify-content: flex-end;
    margin-bottom: 24px;
    max-width: 768px;
}

.blog-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background-color: #F3F4F6;
    color: #555;
    font-family: Almarai, Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
}

.blog-meta-item svg {
    flex-shrink: 0;
    color: #E36167;
}

.blog-meta-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #CCC;
    flex-shrink: 0;
}

/* ── Featured image — smaller size ───────────────────── */

.blog-featured-image {
    margin-bottom: 28px;
}

.blog-featured-image img {
    width: 100%;
    max-width: 768px;
    aspect-ratio: 80 / 51;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10);
    display: block;
    height: unset;
}

/* ── Category pills ──────────────────────────────────── */

.blog-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start; /* flex-start = right in RTL */
    margin-bottom: 28px;
    max-width: 768px;
}

.blog-category-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 999px;
    background-color: rgba(227, 97, 103, 0.10);
    color: #E36167;
    font-family: Almarai, Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.blog-category-pill:hover {
    background-color: #E36167;
    color: #fff;
}

/* ── Body text ───────────────────────────────────────── */

.blog-text {
    font-family: Almarai, Arial, sans-serif;
    font-size: 18px;
    line-height: 1.9;
    color: #333;
    text-align: start;
    max-width: 768px;
}

.blog-text p  { margin-bottom: 24px; }

.blog-text h2 {
    font-size: 30px;
    font-weight: 700;
    margin: 48px 0 20px;
    color: #1A1A1A;
}

.blog-text h3 {
    font-size: 24px;
    font-weight: 600;
    margin: 36px 0 16px;
    color: #1A1A1A;
}

.blog-text ul,
.blog-text ol {
    margin: 20px 0;
    padding-inline-start: 24px;
    padding-inline-end: 0;
}

.blog-text li { margin-bottom: 10px; }

.blog-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 32px auto;
    display: block;
}

.blog-text a {
    color: #E36167;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.blog-text a:hover { border-bottom-color: #E36167; }

/* ── Left column: tags sidebar ───────────────────────── */

.blog-tags-sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.blog-tags-sidebar__label {
    font-family: Almarai, Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 4px;
}

.blog-tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    background-color: #f0f0f0;
    color: #333;
    font-family: Almarai, Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.blog-tag-pill:hover {
    background-color: #E36167;
    color: #fff;
}


/* ── Responsive ──────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
    .blog-single-header__inner,
    .blog-single-container {
        padding: 0 32px;
    }

    .blog-single-wrapper {
        grid-template-columns: 1fr 180px;
        gap: 36px;
    }

    .blog-single-header__title {
        font-size: 30px;
    }
}

/* Small tablet — move tags below content */
@media (max-width: 768px) {
    .blog-single-header {
        padding: 32px 0 28px;
    }

    .blog-single-header__inner,
    .blog-single-container {
        padding: 0 20px;
    }

    .blog-single-header__title {
        font-size: 26px;
    }

    .blog-single-article {
        padding-top: 104px;
        padding-bottom: 60px;
    }

    /* Stack: main content on top, tags below */
    .blog-single-wrapper {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    /* Tags move below content; display horizontally */
    .blog-tags-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding-top: 28px;
        border-top: 1px solid #E0E0E0;
    }

    .blog-featured-image img {
        max-width: 100%;
        border-radius: 10px;
    }

    .blog-text {
        font-size: 17px;
    }

    .blog-text h2 { font-size: 26px; }
    .blog-text h3 { font-size: 22px; }
}

/* Mobile */
@media (max-width: 480px) {
    .blog-single-header__inner,
    .blog-single-container {
        padding: 0 16px;
    }

    .blog-text { font-size: 16px; }
}


/* ════════════════════════════════════════════════════════════════════════════
   Blog Post — Image Gallery
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Section wrapper ─────────────────────────────────────────────────────── */

.blog-gallery {
    margin-top: 56px;
    padding-top: 44px;
    border-top: 2px solid #F0F1F3;
    width: 100%;
    max-width: 768px;
}

/* ── Header: title + count badge ─────────────────────────────────────────── */

.blog-gallery__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    direction: rtl;
}

.blog-gallery__title {
    font-family: Almarai, Arial, sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #1A1A1A;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.blog-gallery__title svg {
    color: #E36167;
    flex-shrink: 0;
}

.blog-gallery__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background-color: rgba(227, 97, 103, 0.12);
    color: #E36167;
    font-family: Almarai, Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

/* ── Grid base ───────────────────────────────────────────────────────────── */

.blog-gallery__grid {
    display: grid;
    gap: 8px;
}

/* — Single image — */

.blog-gallery__grid--single {
    grid-template-columns: 1fr;
}

.blog-gallery__grid--single .blog-gallery__item {
    aspect-ratio: 16 / 9;
    max-height: 500px;
}

/* — Duo (2 images) — */

.blog-gallery__grid--duo {
    grid-template-columns: 1fr 1fr;
}

.blog-gallery__grid--duo .blog-gallery__item {
    aspect-ratio: 4 / 3;
}

/* — Multi (3 + images): first cell spans 2 cols × 2 rows — */

.blog-gallery__grid--multi {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 220px;
}

.blog-gallery__grid--multi .blog-gallery__item:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

/* ── Individual gallery cell ─────────────────────────────────────────────── */

.blog-gallery__item {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    background-color: #F3F4F6;
    text-decoration: none;
}

.blog-gallery__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Hover overlay ───────────────────────────────────────────────────────── */

.blog-gallery__overlay {
    position: absolute;
    inset: 0;
    background: rgba(39, 42, 52, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: background 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}

.blog-gallery__overlay svg {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
    transform: scale(0.7);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.blog-gallery__item:hover .blog-gallery__img {
    transform: scale(1.07);
}

.blog-gallery__item:hover .blog-gallery__overlay {
    background: rgba(39, 42, 52, 0.48);
    opacity: 1;
}

.blog-gallery__item:hover .blog-gallery__overlay svg {
    transform: scale(1);
}

/* Focus ring for keyboard navigation */
.blog-gallery__item:focus-visible {
    outline: 3px solid #E36167;
    outline-offset: 2px;
}


/* ════════════════════════════════════════════════════════════════════════════
   Gallery Lightbox
   ════════════════════════════════════════════════════════════════════════════ */

body.blog-lightbox-open {
    overflow: hidden;
}

.blog-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-lightbox[hidden] { display: none; }

/* Dark backdrop */
.blog-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(39, 42, 52, 0.96);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Image + caption stage */
.blog-lightbox__stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: calc(100vw - 160px);
    max-height: calc(100vh - 120px);
    padding: 0 20px;
}

.blog-lightbox__img {
    max-width: 100%;
    max-height: calc(100vh - 180px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.60);
    display: block;
    transition: opacity 0.25s ease;
}

.blog-lightbox__img--loading {
    opacity: 0.20;
}

.blog-lightbox__caption {
    color: rgba(255, 255, 255, 0.80);
    font-family: Almarai, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
    margin: 0;
    max-width: 560px;
}

/* Close button — top-right corner */
.blog-lightbox__close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.20);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.25s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.blog-lightbox__close:hover {
    background: #E36167;
    border-color: #E36167;
    transform: rotate(90deg);
}

/* Prev / Next navigation buttons */
.blog-lightbox__nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.20);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.blog-lightbox__nav:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.40);
}

.blog-lightbox__nav:disabled {
    opacity: 0.18;
    cursor: default;
    pointer-events: none;
}

.blog-lightbox__nav--prev { left: 20px; }
.blog-lightbox__nav--next { right: 20px; }

/* Image counter — bottom-centre */
.blog-lightbox__counter {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: rgba(255, 255, 255, 0.75);
    font-family: Almarai, Arial, sans-serif;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.45);
    padding: 5px 18px;
    border-radius: 999px;
    white-space: nowrap;
    letter-spacing: 0.04em;
}


/* ── Gallery + Lightbox Responsive ──────────────────────────────────────── */

/* Tablet (≤ 768 px) */
@media (max-width: 768px) {
    .blog-gallery__grid--multi {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 190px;
    }

    /* First item: full width, single row height on mobile */
    .blog-gallery__grid--multi .blog-gallery__item:first-child {
        grid-column: span 2;
        grid-row: span 1;
    }

    .blog-gallery__grid--duo .blog-gallery__item {
        aspect-ratio: 1;
    }

    /* Tighter nav buttons */
    .blog-lightbox__nav          { width: 44px; height: 44px; }
    .blog-lightbox__nav--prev    { left: 8px; }
    .blog-lightbox__nav--next    { right: 8px; }
    .blog-lightbox__stage        { max-width: calc(100vw - 100px); }
}

/* Mobile (≤ 480 px) */
@media (max-width: 480px) {
    .blog-gallery__grid--multi {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 145px;
    }

    .blog-gallery__grid--duo .blog-gallery__item { aspect-ratio: 1; }

    .blog-lightbox__nav          { width: 38px; height: 38px; }
    .blog-lightbox__nav--prev    { left: 4px; }
    .blog-lightbox__nav--next    { right: 4px; }
    .blog-lightbox__stage        { max-width: calc(100vw - 80px); }

    .blog-lightbox__close {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
    }

    .blog-lightbox__counter {
        bottom: 16px;
        font-size: 13px;
        padding: 4px 14px;
    }
}
