/*
Theme Name: مسودّة للنشر
Theme URI: https://blog.asmari.me
Author: سلمان الأسمري
Author URI: https://asmari.me
Description: ثيم مدونة سلمان الأسمري الشخصية - مسودة للنشر
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: asmari-theme
Tags: blog, rtl-language-support, custom-colors, dark-mode
*/

/* ===== CSS Variables ===== */
:root {
    --bg-dark: #07090D;
    --surface-dark: #121820;
    --accent-blue: #1B19A8;
    --accent-secondary: #FFA042;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Noto Sans Arabic', sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ===== Utility Classes ===== */
.container {
    max-width: 1152px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-narrow {
    max-width: 768px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== Glass Effects ===== */
.liquid-glass {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
}

.glass-dark {
    background: rgba(7, 9, 13, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ===== Background Blobs ===== */
.blob-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.1;
    will-change: transform;
}

.blob-1 {
    width: 280px;
    height: 280px;
    background: var(--accent-blue);
    top: -80px;
    right: -80px;
}

.blob-2 {
    width: 220px;
    height: 220px;
    background: var(--accent-secondary);
    bottom: 10%;
    left: -80px;
}

@media (min-width: 768px) {
    .blob {
        filter: blur(80px);
        opacity: 0.12;
    }

    .blob-1 {
        width: 500px;
        height: 500px;
        top: -100px;
        right: -100px;
    }

    .blob-2 {
        width: 400px;
        height: 400px;
        left: -100px;
    }
}

/* ===== Header ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 120;
    padding: 1rem 0;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
}

.site-logo img {
    height: 24px;
    transition: opacity 0.2s;
}

.site-logo:hover img {
    opacity: 0.8;
}

.site-header .container {
    gap: 0.75rem;
}

.header-transparent {
    background: rgba(7, 9, 13, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-actions {
    display: flex;
    align-items: center;
    margin-right: auto;
}

.back-btn {
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.back-btn svg {
    color: var(--accent-blue);
}

.back-btn:hover svg {
    color: white;
}

.search-btn-square {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: #94a3b8;
    transition: all 0.2s;
}

.search-btn-square:hover {
    color: white;
}

/* Header Inline Search */
.header-search {
    display: none;
    padding: 0.5rem 0 0.75rem;
}

.header-search.active {
    display: block;
}

/* Search Results Dropdown */
.search-results-dropdown {
    display: none;
    position: fixed;
    top: 110px;
    left: 0;
    right: 0;
    z-index: 150;
    max-height: 60vh;
    overflow-y: auto;
    background: rgba(7, 9, 13, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1.5rem 1rem;
}

.search-results-dropdown.active {
    display: block;
}

.search-results-dropdown .search-result-item {
    max-width: 672px;
    margin: 0 auto;
}

/* ===== Search ===== */
.search-form {
    display: flex;
    width: 100%;
    max-width: 672px;
    margin: 0 auto;
    gap: 0.75rem;
    align-items: center;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 0.75rem 1.25rem;
    font-size: 16px;
    color: white;
    outline: none;
    font-family: inherit;
}

.search-input::placeholder {
    color: #475569;
}

.search-input:focus {
    border-color: rgba(255, 160, 66, 0.4);
}

.search-cancel {
    color: var(--accent-secondary);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.search-results {
    margin-top: 2rem;
}

.search-result-item {
    display: block;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    border-radius: 0.75rem;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.search-result-title {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.search-result-excerpt {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.5;
}

.search-result-meta {
    font-size: 0.7rem;
    color: #475569;
    margin-top: 0.25rem;
}

.search-no-results {
    text-align: center;
    color: #64748b;
    padding: 3rem 0;
    font-weight: 500;
}


/* ===== Category Navigation ===== */
.category-nav {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 110;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.category-nav .container {
    overflow-x: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.category-nav .container::-webkit-scrollbar {
    display: none;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
}

.category-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(27, 25, 168, 0.2);
}

.category-btn svg {
    color: var(--accent-blue);
}

.category-btn.active svg {
    color: var(--accent-secondary);
}

/* ===== Hero Section ===== */
.hero-section {
    margin-bottom: 3rem;
    max-width: 672px;
    margin-left: auto;
    margin-right: auto;
}

.hero-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0 0 1rem;
}

.hero-section p {
    font-size: 14px;
    color: #64748b;
    line-height: 1.8;
    font-weight: 500;
    margin: 0;
}

.hero-section .highlight {
    color: #cbd5e1;
}

/* ===== Sort Controls ===== */
.sort-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sort-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    opacity: 0.8;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sort-buttons {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: 176px;
}

.sort-btn {
    flex: 1;
    padding: 0.375rem;
    border-radius: 0.5rem;
    font-size: 9px;
    font-weight: 800;
    transition: all 0.2s;
    color: #64748b;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sort-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ===== Posts Grid ===== */
.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
}

@media (min-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== Post Card ===== */
.post-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 1.5rem;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.5s;
    cursor: pointer;
}

.post-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

.post-card:active {
    transform: scale(0.98);
}

.post-card-image {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 1.1rem;
    overflow: hidden;
    margin-bottom: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: rgba(255, 255, 255, 0.05);
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1s;
}

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

.post-card-category {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 0.5rem;
    font-size: 8px;
    font-weight: 700;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.post-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.post-card-date {
    font-size: 10px;
    color: #475569;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.post-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    margin: 0 0 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s;
}

.post-card:hover .post-card-title {
    color: var(--accent-secondary);
}

.post-card-excerpt {
    font-size: 12px;
    color: #64748b;
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 1.5rem;
    flex: 1;
}

.post-card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--accent-secondary);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.post-card-footer svg {
    transition: transform 0.3s;
}

.post-card:hover .post-card-footer svg {
    transform: translateX(-4px);
}

/* ===== Single Post Hero ===== */
.single-hero {
    position: relative;
    width: 100%;
    min-height: clamp(220px, 38vh, 380px);
    overflow: hidden;
}

.single-hero-img {
    width: 100%;
    height: clamp(220px, 38vh, 380px);
    object-fit: cover;
    display: block;
}

.single-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, var(--bg-dark) 0%, rgba(7, 9, 13, 0.6) 50%, transparent 100%);
    pointer-events: none;
}

.single-hero-meta {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    right: 0;
    z-index: 2;
}

.single-hero-tag {
    color: var(--accent-secondary);
    font-size: 12px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.single-hero-tag:hover {
    opacity: 0.7;
}

/* ===== Single Post ===== */
.single-post {
    padding-bottom: 2.5rem;
}

.single-post.has-hero {
    padding-top: 0;
}

.single-post.no-hero {
    padding-top: 0;
}

.post-meta {
    margin-bottom: 1.5rem;
}

.post-meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.post-category-badge {
    padding: 0.25rem 0.75rem;
    background: rgba(27, 25, 168, 0.15);
    color: var(--accent-secondary);
    border-radius: 0.5rem;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid rgba(27, 25, 168, 0.25);
    transition: background 0.2s;
}

.post-category-badge:hover {
    background: rgba(27, 25, 168, 0.3);
}

.post-date {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

.post-title {
    font-size: 1.875rem;
    font-weight: 800;
    color: white;
    line-height: 1.3;
    margin: 0.75rem 0 1rem;
}

.post-title-bar {
    width: 4rem;
    height: 4px;
    background: var(--accent-blue);
    border-radius: 9999px;
    margin-bottom: 1.5rem;
}

/* ===== Post Content ===== */
.post-content {
    color: var(--text-secondary);
    font-size: 17px;
    line-height: 1.8;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.post-content * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.post-content p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.post-content a {
    color: var(--accent-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}

.post-content a:hover {
    opacity: 0.8;
}

.post-content a.hashtag-link {
    color: var(--accent-secondary) !important;
    text-decoration: none !important;
    font-weight: 400 !important;
    background: none !important;
    padding: 0 !important;
}

.post-content a.hashtag-link:hover {
    opacity: 0.7;
}

.post-content img {
    border-radius: 1.5rem;
    margin: 2rem 0 0 !important;
    padding: 0 !important;
    height: auto !important;
    display: block;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.post-content figure img,
.post-content .wp-block-image img {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.post-content figcaption,
.post-content .wp-caption-text,
.post-content .gallery-caption,
.post-content .wp-element-caption,
.post-content .wp-block-image figcaption {
    font-size: 0.75rem !important;
    color: #64748b !important;
    text-align: right !important;
    margin: 10px 0 1rem 0 !important;
    padding: 0 !important;
    direction: rtl;
    line-height: 1.2 !important;
    display: block !important;
}

.post-content figure,
.post-content .wp-block-image {
    margin: 0 0 1.5rem 0 !important;
    padding: 0 !important;
    display: block !important;
}

.post-content iframe,
.post-content video {
    width: 100% !important;
    aspect-ratio: 16 / 9;
    height: auto !important;
    border-radius: 1.5rem;
    margin: 2rem 0;
}

/* ===== Share Section ===== */
.share-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.share-button {
    width: 100%;
    max-width: 384px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 1rem;
    color: white;
    font-weight: 700;
    transition: transform 0.2s;
}

.share-button:active {
    transform: scale(0.95);
}

.share-button svg {
    color: var(--accent-secondary);
}

/* ===== Archive/Tag Page ===== */
.archive-header {
    margin-bottom: 3rem;
    text-align: center;
    max-width: 672px;
    margin-left: auto;
    margin-right: auto;
}

.archive-title {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(255, 160, 66, 0.1);
    color: var(--accent-secondary);
    border-radius: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    border: 1px solid rgba(255, 160, 66, 0.2);
    margin-bottom: 1rem;
}

.archive-count {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

/* ===== Footer ===== */
.site-footer {
    margin-top: 5rem;
    padding-top: 2.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

.footer-logo img {
    height: 3rem;
    width: auto;
    object-fit: contain;
    transition: all 0.3s;
}

.footer-logo:hover img {
    filter: brightness(0) saturate(100%) invert(73%) sepia(45%) saturate(1525%) hue-rotate(331deg) brightness(101%) contrast(101%);
}

.social-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.social-links a {
    color: #475569;
    transition: color 0.2s;
}

.social-links a:hover {
    color: var(--accent-secondary);
}

.footer-copyright {
    font-size: 9px;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-bottom: 3rem;
    opacity: 0.5;
    text-align: center;
}

/* ===== Gallery Slideshow (Swiper) ===== */
.gallery-slideshow {
    margin: 2rem 0;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.gallery-slideshow .swiper {
    width: 100%;
    height: auto;
}

.gallery-slideshow .swiper-slide {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.gallery-slideshow .swiper-slide img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    margin: 0 !important;
    padding: 0 !important;
}

.swiper-caption {
    font-size: 0.75rem !important;
    color: #64748b !important;
    text-align: right;
    padding: 1rem 1.5rem;
    direction: rtl;
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
}

/* Swiper Navigation Buttons */
.gallery-slideshow .swiper-button-next,
.gallery-slideshow .swiper-button-prev {
    color: white;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: all 0.3s;
}

.gallery-slideshow .swiper-button-next:hover,
.gallery-slideshow .swiper-button-prev:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.gallery-slideshow .swiper-button-next::after,
.gallery-slideshow .swiper-button-prev::after {
    font-size: 20px;
}

/* Swiper Pagination */
.gallery-slideshow .swiper-pagination {
    bottom: 20px;
}

.gallery-slideshow .swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: all 0.3s;
}

.gallery-slideshow .swiper-pagination-bullet-active {
    background: var(--accent-secondary);
    transform: scale(1.3);
}

/* Swiper gallery slideshow */
.gallery-slideshow {
    display: block !important;
}

/* Hide original gallery only after Swiper replaces it */
.wp-block-gallery.swiper-processed,
.gallery.swiper-processed {
    display: none !important;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 5rem 0;
}

.empty-state p {
    color: #64748b;
    font-weight: 500;
}

.empty-state a {
    display: inline-block;
    margin-top: 1rem;
    color: var(--accent-secondary);
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.entry-anim {
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
    .site-logo img {
        height: 32px;
    }

    .category-nav {
        top: 88px;
    }

    .category-nav .container {
        justify-content: center;
    }

    .category-btn {
        font-size: 13px;
    }

    .hero-section {
        text-align: center;
        margin-bottom: 4rem;
    }

    .hero-section h1 {
        font-size: 2.25rem;
    }

    .hero-section p {
        font-size: 1.125rem;
    }

    .sort-buttons {
        width: 224px;
    }

    .sort-btn {
        font-size: 11px;
    }

    .post-card-title {
        font-size: 1.25rem;
    }

    .post-card-excerpt {
        font-size: 14px;
    }

    .post-card-footer {
        font-size: 11px;
    }

    .single-hero {
        min-height: clamp(300px, 42vh, 450px);
    }

    .single-hero-img {
        height: clamp(300px, 42vh, 450px);
    }

    .post-title {
        font-size: 2.5rem;
    }

    .post-content {
        font-size: 19px;
    }

    .archive-title {
        font-size: 1.875rem;
    }

    .slideshow-nav {
        display: block;
    }
}

/* ===== Main Content Padding ===== */
.main-content {
    padding-top: 12rem;
}

@media (min-width: 768px) {
    .main-content {
        padding-top: 14rem;
    }
}

/* ===== Loading State ===== */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.loading-spinner svg {
    animation: spin 1s linear infinite;
    color: var(--accent-blue);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
