/* Posts / Magazine page */
:root {
    --pm-nav-height: 80px;
    --pm-brand: #009ae0;
    --pm-brand-dark: #0077b3;
    --pm-brand-light: #e6f6fd;
    --pm-text: #0f172a;
    --pm-text-muted: #64748b;
    --pm-border: #e2e8f0;
    --pm-bg: #f0f4f8;
    --pm-radius: 16px;
    --pm-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 20px rgba(15, 23, 42, 0.05);
    --pm-shadow-hover: 0 8px 30px rgba(15, 23, 42, 0.12);
}

@media (max-width: 768px) {
    :root {
        --pm-nav-height: 60px;
    }
}

.posts-magazine-wrap {
    margin-top: -50px;
    padding-top: var(--pm-nav-height);
    background: var(--pm-bg);
    min-height: 100vh;
    padding-bottom: 3rem;
}

.posts-magazine-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.35rem 1.25rem 0;
}

/* Breadcrumb */
.posts-magazine-page .pm-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    font-size: 0.8125rem;
    color: var(--pm-text-muted);
}

.posts-magazine-page .pm-breadcrumb a {
    color: var(--pm-brand);
    text-decoration: none;
    transition: color 0.15s;
}

.posts-magazine-page .pm-breadcrumb a:hover {
    color: var(--pm-brand-dark);
}

.posts-magazine-page .pm-breadcrumb li:not(:last-child)::after {
    content: "›";
    margin-right: 0.35rem;
    color: #94a3b8;
}

.posts-magazine-page .pm-breadcrumb li:last-child {
    color: var(--pm-text);
    font-weight: 500;
}

/* Hero header */
.pm-hero {
    background: linear-gradient(135deg, #fff 0%, var(--pm-brand-light) 100%);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--pm-shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: right;
}

.pm-hero-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--pm-brand), var(--pm-brand-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 154, 224, 0.35);
}

.pm-hero-icon .material-icons {
    font-size: 28px;
}

.pm-hero-text h1 {
    margin: 0 0 0.35rem;
    font-size: 1.35rem !important;
    font-weight: 700;
    color: var(--pm-text);
    line-height: 1.4;
}

.pm-hero-text p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--pm-text-muted);
    line-height: 1.6;
}

/* Active category filter */
.pm-filter-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid var(--pm-border);
    border-radius: 12px;
    padding: 0.65rem 1rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--pm-shadow);
}

.pm-filter-bar.is-visible {
    display: flex;
}

.pm-filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--pm-text);
}

.pm-filter-label .material-icons {
    font-size: 20px;
    color: var(--pm-brand);
}

.pm-filter-label strong {
    color: var(--pm-brand-dark);
}

.pm-filter-clear {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--pm-border);
    border-radius: 8px;
    background: #fff;
    color: var(--pm-text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-family: inherit;
}

.pm-filter-clear:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.pm-filter-clear .material-icons {
    font-size: 18px;
}

/* Categories */
.pm-categories-section {
    margin-bottom: 1.75rem;
}

.pm-section-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--pm-text);
    margin: 0 0 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pm-section-title .material-icons {
    font-size: 20px;
    color: var(--pm-brand);
}

.posts-magazine-page .category-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.85rem;
    overflow-x: auto;
    padding: 0.25rem 0.15rem 0.75rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--pm-brand) transparent;
    text-align: right;
}

.posts-magazine-page .category-list::-webkit-scrollbar {
    height: 6px;
}

.posts-magazine-page .category-list::-webkit-scrollbar-thumb {
    background: var(--pm-brand);
    border-radius: 3px;
}

.posts-magazine-page .category-list .gallery-cell {
    flex: 0 0 auto;
    width: 130px;
    margin: 0;
    display: block;
    scroll-snap-align: start;
}

.posts-magazine-page .category-list .category-card {
    height: auto;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--pm-shadow);
    border: 2px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    background: #fff;
}

.posts-magazine-page .category-list .category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--pm-shadow-hover);
    border-color: var(--pm-brand-light);
}

.posts-magazine-page .category-list .category-card.is-active {
    border-color: var(--pm-brand);
    box-shadow: 0 0 0 3px rgba(0, 154, 224, 0.15);
}

.posts-magazine-page .category-list .card .card-image {
    height: 88px;
    position: relative;
    overflow: hidden;
}

.posts-magazine-page .category-list .card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    min-height: 100%;
    transition: transform 0.3s;
}

.posts-magazine-page .category-list .category-card:hover .card-image img {
    transform: scale(1.05);
}

.posts-magazine-page .category-list .card .card-content {
    text-align: center;
    padding: 0.55rem 0.4rem;
}

.posts-magazine-page .category-list .card .card-content .card-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pm-text);
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Posts grid */
.pm-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

@media (max-width: 992px) {
    .pm-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .pm-posts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .pm-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.15rem;
    }
}

.pm-post-card {
    background: #fff;
    border-radius: var(--pm-radius);
    overflow: hidden;
    box-shadow: var(--pm-shadow);
    border: 1px solid var(--pm-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.22s, box-shadow 0.22s;
    text-align: right;
    direction: rtl;
}

.pm-post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--pm-shadow-hover);
}

.pm-post-image {
    display: block;
    position: relative;
    height: 180px;
    overflow: hidden;
    background: #e2e8f0;
}

.pm-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.35s;
}

.pm-post-card:hover .pm-post-image img {
    transform: scale(1.06);
}

.pm-post-body {
    padding: 1rem 1.1rem 1.1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.pm-post-category {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--pm-brand-dark);
    background: var(--pm-brand-light);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    line-height: 1.5;
}

.pm-post-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.55;
    flex: 1;
}

.pm-post-title a {
    color: var(--pm-text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s;
}

.pm-post-card:hover .pm-post-title a {
    color: var(--pm-brand);
}

.pm-post-meta {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--pm-text-muted);
    margin-top: auto;
    padding-top: 0.35rem;
    border-top: 1px solid var(--pm-border);
}

.pm-post-meta .material-icons {
    font-size: 16px;
    color: #94a3b8;
}

/* Preloader */
.posts-magazine-page .posts-list .section-preloader {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 3rem;
}

/* Override legacy horizontal card styles inside magazine page */
.posts-magazine-page .card.post-card {
    height: auto;
}

.posts-magazine-page .page-subtitle {
    display: none !important;
}

/* ── Post detail page ── */
.pm-detail-page {
    max-width: 820px;
}

.pm-article {
    background: #fff;
    border-radius: var(--pm-radius);
    border: 1px solid var(--pm-border);
    box-shadow: var(--pm-shadow);
    overflow: hidden;
    direction: rtl;
    text-align: right;
}

.pm-article-hero {
    position: relative;
    width: 100%;
    max-height: 420px;
    overflow: hidden;
    background: #e2e8f0;
}

.pm-article-hero img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    object-position: center;
    display: block;
}

.pm-article-hero.is-video {
    max-height: none;
    background: #0f172a;
}

.pm-article-hero video {
    width: 100%;
    max-height: 420px;
    display: block;
    background: #000;
}

.pm-article-header {
    padding: 1.5rem 1.75rem 1rem;
    border-bottom: 1px solid var(--pm-border);
}

.pm-article-title {
    margin: 0.65rem 0 0.85rem;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.55;
    color: var(--pm-text);
}

.pm-article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--pm-text-muted);
}

.pm-article-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.pm-article-meta-item .material-icons {
    font-size: 18px;
    color: #94a3b8;
}

.pm-article-body {
    padding: 1.5rem 1.75rem 1.75rem;
    font-size: 1rem;
    line-height: 1.9;
    color: #334155;
    word-wrap: break-word;
}

.pm-article-body p {
    margin: 0 0 1rem;
}

.pm-article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 1rem 0;
}

.pm-article-body h2,
.pm-article-body h3,
.pm-article-body h4 {
    color: var(--pm-text);
    margin: 1.5rem 0 0.75rem;
    line-height: 1.45;
}

.pm-article-body ul,
.pm-article-body ol {
    padding-right: 1.25rem;
    margin: 0 0 1rem;
}

.pm-article-body a {
    color: var(--pm-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.pm-article-body a:hover {
    color: var(--pm-brand-dark);
}

.pm-article-footer {
    padding: 0 1.75rem 1.75rem;
}

/* Buttons */
.pm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
    font-family: inherit;
    cursor: pointer;
    border: none;
}

.pm-btn .material-icons {
    font-size: 18px;
}

.pm-btn-primary {
    background: linear-gradient(135deg, var(--pm-brand), var(--pm-brand-dark));
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 154, 224, 0.3);
}

.pm-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 154, 224, 0.4);
    color: #fff;
}

.pm-btn-outline {
    background: #fff;
    color: var(--pm-text);
    border: 1px solid var(--pm-border);
}

.pm-btn-outline:hover {
    background: var(--pm-brand-light);
    border-color: var(--pm-brand);
    color: var(--pm-brand-dark);
}

/* Not found state */
.pm-not-found {
    background: #fff;
    border-radius: var(--pm-radius);
    border: 1px solid var(--pm-border);
    box-shadow: var(--pm-shadow);
    padding: 3rem 2rem;
    text-align: center;
    direction: rtl;
}

.pm-not-found-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: var(--pm-brand-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pm-brand);
}

.pm-not-found-icon .material-icons {
    font-size: 36px;
}

.pm-not-found-title {
    margin: 0 0 0.75rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--pm-text);
}

.pm-not-found-text {
    margin: 0 auto 1.75rem;
    max-width: 420px;
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--pm-text-muted);
}

.pm-not-found-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

@media (max-width: 576px) {
    .pm-article-header,
    .pm-article-body,
    .pm-article-footer {
        padding-right: 1.15rem;
        padding-left: 1.15rem;
    }

    .pm-article-title {
        font-size: 1.2rem;
    }

    .pm-not-found {
        padding: 2rem 1.25rem;
    }
}
