/**
 * Clean, Minimalist & Fast CSS for Personal Website
 * Fully Responsive, Persian RTL-first, Accessible (WCAG AA)
 * Designed with the VibeFarsi "انار" (Pomegranate) Design System & Components
 * Source: https://vibefarsi.ir/themes/pomegranate & https://vibefarsi.ir/components
 */

@import url("vibefarsi-pomegranate.css");

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--type-body);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.75;
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--motion) var(--motion-ease), color var(--motion) var(--motion-ease);
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 24px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--foreground);
    font-family: var(--type-display);
    font-weight: var(--type-display-weight);
    line-height: 1.35;
    margin-bottom: 0.85rem;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }

p {
    margin-bottom: 1.15rem;
    color: var(--muted-foreground);
    line-height: 1.8;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--motion) var(--motion-ease);
}

a:hover, a:focus {
    color: var(--primary-hover);
    text-decoration: none;
}

/* ==========================================================================
   HEADER & NAVIGATION (Pill Capsule Nav with Soft Clay Header)
   ========================================================================== */
.site-header {
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px -10px oklch(0.27 0.05 15 / 6%);
    transition: background-color var(--motion) var(--motion-ease), border-color var(--motion) var(--motion-ease);
}

.header-inner {
    display: flex;
    align-items: center;
    height: 76px;
    position: relative;
}

.site-logo {
    font-family: var(--type-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--foreground);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: var(--shape-control);
    transition: transform var(--motion) var(--motion-ease);
}

.site-logo:hover {
    transform: scale(1.03);
}

.logo-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 12px oklch(0.6 0.2 18 / 65%);
    display: inline-block;
}

.site-nav-container {
    margin-inline-start: 32px;
    flex: 1;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.nav-link {
    color: var(--foreground);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 8px 16px;
    border-radius: var(--shape-control);
    border: 1px solid transparent;
    transition: all var(--motion) var(--motion-ease);
    text-decoration: none;
}

.nav-link:hover {
    background-color: var(--secondary);
    color: var(--foreground);
    border-color: var(--border);
    transform: translateY(-2px);
}

.nav-link.active {
    background-color: var(--primary);
    color: var(--primary-foreground) !important;
    box-shadow: var(--depth-control);
}

/* Header Actions & Theme Toggle */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-inline-start: auto;
}

.theme-toggle-btn {
    background-color: var(--card) !important;
    border: 1px solid var(--border) !important;
    color: var(--foreground) !important;
    border-radius: var(--shape-control) !important;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--depth-control) !important;
    transition: transform var(--motion) var(--motion-ease),
                box-shadow var(--motion) var(--motion-ease),
                background-color var(--motion) var(--motion-ease);
}

.theme-toggle-btn:hover {
    transform: translateY(-2px) rotate(15deg);
    box-shadow: var(--depth-control-hover) !important;
    color: var(--primary) !important;
}

.theme-toggle-btn:active {
    transform: var(--press) !important;
    box-shadow: var(--depth-press) !important;
}

.theme-icon {
    display: inline-block;
    vertical-align: middle;
    transition: transform 0.25s ease, stroke 0.25s ease;
}

/* Mobile Nav Toggle */
.mobile-toggle {
    display: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--shape-control);
    width: 42px;
    height: 42px;
    cursor: pointer;
    padding: 10px 9px;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    box-shadow: var(--depth-control);
    transition: transform var(--motion) var(--motion-ease),
                box-shadow var(--motion) var(--motion-ease);
}

.mobile-toggle:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.mobile-toggle:active {
    transform: var(--press);
    box-shadow: var(--depth-press);
}

.mobile-toggle .bar {
    width: 22px;
    height: 2.5px;
    background-color: var(--foreground);
    border-radius: 999px;
    transition: all 0.2s ease;
}

/* ==========================================================================
   HERO SECTION (Puffy Soft Clay Hero)
   ========================================================================== */
.hero-section {
    padding: 72px 0 56px;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 48px;
    align-items: center;
}

.hero-content h1 {
    font-size: 2.6rem;
    margin-bottom: 10px;
    font-family: var(--type-display);
    font-weight: 800;
}

.hero-title {
    font-size: 1.25rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 18px;
    display: inline-block;
    padding: 4px 16px;
    border-radius: var(--shape-control);
    background-color: var(--secondary);
    border: 1px solid var(--border);
}

.hero-bio {
    font-size: 1.1rem;
    color: var(--muted-foreground);
    max-width: 680px;
    margin-bottom: 28px;
    line-height: 1.9;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.hero-avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--card);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6),
                0 20px 40px -15px oklch(0.6 0.2 18 / 30%);
    transition: transform var(--motion) var(--motion-ease);
}

.hero-avatar:hover {
    transform: scale(1.05) rotate(2deg);
}

/* ==========================================================================
   SECTIONS & SECTION HEADERS
   ========================================================================== */
.section {
    padding: 64px 0;
    border-bottom: 1px solid var(--border);
}

.section-header {
    margin-bottom: 36px;
}

.section-header h2 {
    font-size: 1.85rem;
    margin-bottom: 8px;
    font-family: var(--type-display);
    font-weight: 800;
}

.section-header p {
    color: var(--muted-foreground);
    font-size: 1rem;
    margin-bottom: 0;
}

/* ==========================================================================
   SKILLS GRID (28px Cards with Spring Physics)
   ========================================================================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 24px;
}

.skill-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--shape-surface) !important;
    padding: 26px;
    box-shadow: var(--depth-surface) !important;
    transition: transform var(--motion) var(--motion-ease),
                box-shadow var(--motion) var(--motion-ease),
                border-color var(--motion) var(--motion-ease);
}

.skill-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--depth-surface-hover) !important;
    border-color: oklch(0.6 0.2 18 / 25%);
}

.skill-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

/* ==========================================================================
   EXPERIENCE & EDUCATION TIMELINE
   ========================================================================== */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 28px;
    border-right: 2px dashed var(--border);
    padding-right: 24px;
    margin-right: 12px;
}

.timeline-item {
    position: relative;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--shape-surface);
    padding: 22px 24px;
    box-shadow: var(--depth-surface);
    transition: transform var(--motion) var(--motion-ease),
                box-shadow var(--motion) var(--motion-ease);
}

.timeline-item:hover {
    transform: translateX(-4px);
    box-shadow: var(--depth-surface-hover);
}

.timeline-item::after {
    content: '';
    position: absolute;
    top: 24px;
    right: -32px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--primary);
    border: 3px solid var(--background);
    box-shadow: 0 0 10px oklch(0.6 0.2 18 / 60%);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 8px;
}

.timeline-title {
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--foreground);
}

.timeline-period {
    font-size: 0.85rem;
    color: var(--primary);
    background-color: var(--secondary);
    padding: 3px 12px;
    border-radius: var(--shape-control);
    font-weight: 600;
}

.timeline-sub {
    font-size: 0.95rem;
    color: var(--muted-foreground);
    margin-bottom: 10px;
    font-weight: 500;
}

/* ==========================================================================
   PROJECTS GRID (28px Clay Surface Cards)
   ========================================================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 28px;
}

.project-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--shape-surface) !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--depth-surface) !important;
    transition: transform var(--motion) var(--motion-ease),
                box-shadow var(--motion) var(--motion-ease),
                border-color var(--motion) var(--motion-ease);
    padding: 0 !important;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--depth-surface-hover) !important;
    border-color: oklch(0.6 0.2 18 / 25%);
}

.project-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--secondary);
    border-bottom: 1px solid var(--border);
}

.project-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-size: 1.25rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.project-summary {
    font-size: 0.95rem;
    color: var(--muted-foreground);
    flex: 1;
    margin-bottom: 18px;
    line-height: 1.7;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.project-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
}

/* ==========================================================================
   3-COLUMN BLOG LAYOUT & WIDGETS
   ========================================================================== */
.blog-layout {
    display: grid;
    grid-template-columns: 260px 1fr 260px;
    gap: 32px;
    padding: 44px 0;
    align-items: start;
}

.blog-main {
    min-width: 0;
}

.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.widget {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--shape-surface) !important;
    padding: 24px;
    box-shadow: var(--depth-surface) !important;
}

.widget-title {
    font-size: 1.05rem;
    font-family: var(--type-display);
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 16px;
    color: var(--foreground);
}

.widget-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.widget-list a {
    color: var(--foreground);
    font-size: 0.92rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    border-radius: var(--shape-control);
    transition: all var(--motion) var(--motion-ease);
}

.widget-list a:hover {
    background-color: var(--secondary);
    color: var(--primary);
    transform: translateX(-3px);
}

.widget-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.widget-tag-item {
    background-color: var(--secondary);
    border: 1px solid var(--border);
    color: var(--foreground);
    padding: 4px 12px;
    border-radius: var(--shape-control);
    font-size: 0.82rem;
    font-weight: 500;
    transition: all var(--motion) var(--motion-ease);
}

.widget-tag-item:hover {
    background-color: var(--primary);
    color: var(--primary-foreground);
    box-shadow: var(--depth-control);
    transform: translateY(-2px);
}

/* ==========================================================================
   POST CARDS (28px Surface with Spring Physics)
   ========================================================================== */
.post-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--shape-surface) !important;
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: var(--depth-surface) !important;
    transition: transform var(--motion) var(--motion-ease),
                box-shadow var(--motion) var(--motion-ease),
                border-color var(--motion) var(--motion-ease);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--depth-surface-hover) !important;
    border-color: oklch(0.6 0.2 18 / 25%);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--muted-foreground);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.post-meta-category {
    color: var(--primary);
    font-weight: 700;
    background-color: var(--secondary);
    padding: 2px 10px;
    border-radius: var(--shape-control);
}

.post-card-title {
    font-size: 1.4rem;
    margin-bottom: 12px;
    font-family: var(--type-display);
    font-weight: 700;
}

.post-card-title a {
    color: var(--foreground);
    text-decoration: none;
    transition: color var(--motion) var(--motion-ease);
}

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

.post-card-excerpt {
    color: var(--muted-foreground);
    font-size: 0.98rem;
    margin-bottom: 20px;
    line-height: 1.8;
}

.post-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================================================
   SINGLE POST DETAIL (28px Surface with Typographic Polish)
   ========================================================================== */
.post-detail {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--shape-surface) !important;
    padding: 44px;
    box-shadow: var(--depth-surface) !important;
}

.post-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 28px;
    margin-bottom: 32px;
}

.post-header h1 {
    font-size: 2.2rem;
    margin-bottom: 16px;
    font-family: var(--type-display);
    font-weight: 800;
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.95;
    color: var(--foreground);
}

.post-content p {
    text-align: justify;
    text-justify: inter-word;
    margin-bottom: 1.4rem;
}

/* Alignment Classes */
.ql-align-justify,
.post-content .ql-align-justify,
.post-detail .ql-align-justify,
.text-justify {
    text-align: justify !important;
    text-justify: inter-word !important;
}

.ql-align-center,
.post-content .ql-align-center,
.post-detail .ql-align-center {
    text-align: center !important;
}

.ql-align-right,
.post-content .ql-align-right,
.post-detail .ql-align-right {
    text-align: right !important;
}

.ql-align-left,
.post-content .ql-align-left,
.post-detail .ql-align-left {
    text-align: left !important;
}

/* Persian Font Selections */
.font-vazirmatn, [data-font="vazirmatn"], body[data-font="vazirmatn"] {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}
.font-yekan, [data-font="yekan"], body[data-font="yekan"] {
    font-family: 'Yekan', 'BYekan', 'IranYekan', 'Vazirmatn', sans-serif !important;
}
.font-tahoma, [data-font="tahoma"], body[data-font="tahoma"] {
    font-family: 'Tahoma', 'Segoe UI', Arial, sans-serif !important;
}
.font-nazanin, [data-font="nazanin"], body[data-font="nazanin"] {
    font-family: 'B Nazanin', 'Nazanin', 'Lotus', 'Times New Roman', serif !important;
}
.font-sahel, [data-font="sahel"], body[data-font="sahel"] {
    font-family: 'Sahel', 'Samim', 'Vazirmatn', sans-serif !important;
}
.font-courier, [data-font="courier"], body[data-font="courier"] {
    font-family: 'Consolas', 'Courier New', 'Vazirmatn', monospace !important;
}
.font-system, [data-font="system"], body[data-font="system"] {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.post-content h2, .post-content h3 {
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    font-family: var(--type-display);
    font-weight: 800;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--shape-field);
    margin: 1.8rem 0;
    box-shadow: var(--depth-surface);
}

.post-content pre {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--shape-field);
    box-shadow: var(--depth-field);
    padding: 20px;
    overflow-x: auto;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.92rem;
    direction: ltr !important;
    text-align: left !important;
    margin: 1.8rem 0;
}

.post-content code {
    font-family: Consolas, Monaco, monospace;
    background: var(--secondary);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.88em;
    direction: ltr;
    display: inline-block;
}

.post-content pre code {
    padding: 0;
    background: none;
    display: block;
}

/* ==========================================================================
   PAGINATION (Capsule Pill Items)
   ========================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 40px 0;
    list-style: none;
}

.page-item a, .page-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--shape-control);
    background-color: var(--card);
    color: var(--foreground);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--depth-control);
    transition: all var(--motion) var(--motion-ease);
}

.page-item a:hover {
    background-color: var(--accent);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--depth-control-hover);
}

.page-item.active span {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
    box-shadow: var(--depth-control);
}

/* ==========================================================================
   FOOTER (Puffy Clay Surface)
   ========================================================================== */
.site-footer {
    background: var(--footer-bg);
    border-top: 1px solid var(--border);
    padding: 48px 0 32px;
    margin-top: 72px;
    transition: background-color var(--motion) var(--motion-ease), border-color var(--motion) var(--motion-ease);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-copy {
    color: var(--muted-foreground);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 20px;
    font-size: 0.92rem;
}

.footer-links a {
    color: var(--muted-foreground);
    padding: 4px 12px;
    border-radius: var(--shape-control);
    transition: all var(--motion) var(--motion-ease);
}

.footer-links a:hover {
    background-color: var(--secondary);
    color: var(--primary);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS & MOBILE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 992px) {
    .blog-layout {
        grid-template-columns: 1fr;
    }
    .blog-main {
        order: 1;
    }
    .blog-sidebar-left {
        order: 2;
    }
    .blog-sidebar-right {
        order: 3;
    }
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .hero-avatar {
        margin: 0 auto;
    }
    .hero-actions {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .site-nav-container {
        margin-inline-start: 0;
        flex: 0;
    }
    .site-nav {
        display: none;
        position: absolute;
        top: 76px;
        right: 0;
        left: 0;
        background: var(--card);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--depth-surface-hover);
        flex-direction: column;
        padding: 20px;
        gap: 12px;
        z-index: 99;
    }
    .site-nav.open {
        display: flex;
    }
    .mobile-toggle {
        display: flex;
    }
    .post-detail {
        padding: 24px;
    }
}

/* Print CSS */
@media print {
    .site-header, .site-footer, .blog-sidebar, .btn, .no-print, .theme-toggle-btn, .mobile-toggle {
        display: none !important;
    }
    body {
        background: #fff;
        color: #000;
        font-size: 11pt;
    }
    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }
    a {
        text-decoration: none !important;
        color: #000 !important;
    }
}
