@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&display=swap');

:root {
    --primary-color: #0f766e;
    --primary-deep: #115e59;
    --telegram-blue: #2AABEE;
    --text-color: #1a2e2b;
    --bg-color: #f3f7f6;
    --card-bg: #fff;
    --border-color: #d5e5e1;
    --muted: #5a736e;
    --font-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', 'Arial', sans-serif;
    --header-grad: linear-gradient(135deg, #115e59 0%, #0f766e 55%, #1e6f5c 100%);
    --radius: 12px;
    --space: 1rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem clamp(0.85rem, 3vw, 1.25rem);
}

/* —— Site header (archive / about / article) —— */
.site-header,
header {
    background: var(--header-grad);
    color: #fff;
    padding: 0.85rem 0;
    margin-bottom: 1.15rem;
    border-bottom: none;
    box-shadow: 0 4px 18px rgba(15, 47, 44, 0.14);
    text-align: right;
}

.site-header .container,
header .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.site-header__brand,
.site-brand {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    min-width: 0;
    flex: 1 1 auto;
}

.site-header h1,
header h1 {
    margin: 0;
    font-size: clamp(1.15rem, 4vw, 1.45rem);
    font-weight: 700;
    line-height: 1.25;
}

.site-header h1 a,
header h1 a {
    text-decoration: none;
    color: #fff;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.85rem;
}

.site-nav a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.4rem 0.25rem;
    border-radius: 0.4rem;
    white-space: nowrap;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.site-header__actions,
.site-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
}

.site-actions a:not(.btn-telegram) {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.88rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.5rem;
    white-space: nowrap;
}

.site-actions a:not(.btn-telegram):hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.post-card {
    background: var(--card-bg);
    padding: clamp(1rem, 3vw, 1.35rem);
    margin-bottom: 1.15rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(15, 47, 44, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 47, 44, 0.1);
}

.post-title {
    margin-top: 0;
    font-size: clamp(1.05rem, 3.5vw, 1.25rem);
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.post-title a {
    text-decoration: none;
    color: #0f2f2c;
}

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

.post-meta {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.85rem;
}

.post-excerpt {
    font-size: 0.95rem;
    color: #334;
    word-wrap: break-word;
}

.post-content {
    font-size: 1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.post-media {
    margin-bottom: 1.15rem;
}

.post-media img,
.post-media video,
.post-thumb img,
.post-thumb video {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0 auto 10px;
}

.post-thumb img,
.post-thumb video {
    height: clamp(160px, 45vw, 250px);
    object-fit: cover;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0.45rem 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-color);
    border-radius: 8px;
    font-size: 0.92rem;
}

.pagination a.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.btn-telegram {
    background-color: var(--telegram-blue);
    color: white !important;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(42, 171, 238, 0.28);
}

.btn-telegram:hover {
    background-color: #1e8bc4;
}

.breadcrumbs {
    font-size: 0.9em;
    color: var(--muted);
    margin-bottom: 0.85rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
}

blockquote {
    border-right: 4px solid var(--primary-color);
    background-color: #eefaf7;
    margin: 10px 0;
    padding: 10px 15px;
    border-radius: 4px;
    color: #334;
}

tg-spoiler {
    background-color: #ccc;
    color: transparent;
    cursor: pointer;
    border-radius: 3px;
    padding: 0 2px;
    transition: all 0.2s;
    user-select: none;
}

tg-spoiler:hover,
tg-spoiler:active {
    background-color: transparent;
    color: inherit;
    user-select: text;
}

.related-news {
    margin-top: 2rem;
    border-top: 2px solid #e4eeeb;
    padding-top: 1.15rem;
}

.related-news h3 {
    font-size: clamp(1.2rem, 4vw, 1.45rem);
    margin-bottom: 1rem;
    color: #1a2e2b;
    border-right: 4px solid var(--primary-color);
    padding-right: 10px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 1rem;
}

.related-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(15, 47, 44, 0.08);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
}

.related-card:hover {
    transform: translateY(-3px);
}

.related-thumb {
    height: 150px;
    overflow: hidden;
    background: #eef4f2;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-content {
    padding: 0.9rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.related-title {
    font-size: 0.98rem;
    margin: 0 0 0.55rem;
    line-height: 1.4;
    font-weight: bold;
}

.related-title a {
    color: #1a2e2b;
    text-decoration: none;
}

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

.related-meta {
    font-size: 0.8rem;
    color: #888;
    margin-top: auto;
}

.telegram-link-box {
    background: #eef8ff;
    border: 1px solid #cce5ff;
    padding: 0.95rem;
    border-radius: var(--radius);
    margin: 1.15rem 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

@media (min-width: 600px) {
    .telegram-link-box {
        flex-direction: row;
        justify-content: space-between;
        text-align: right;
    }
}

.telegram-link-btn {
    background-color: #2AABEE;
    color: white !important;
    padding: 0.65rem 1.35rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 5px rgba(42, 171, 238, 0.3);
}

.telegram-link-btn:hover {
    background-color: #1e8bc4;
    transform: translateY(-1px);
}

.site-footer {
    text-align: center;
    padding: 1.25rem 1rem;
    color: var(--muted);
    font-size: 0.9em;
    border-top: 1px solid #e4eeeb;
    margin-top: 2rem;
}

.site-footer a {
    color: var(--muted);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--primary-deep);
}

/* Mobile header: stack cleanly */
@media (max-width: 640px) {
    .site-header .container,
    header .container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.7rem;
    }

    .site-header__brand,
    .site-brand {
        justify-content: space-between;
        width: 100%;
    }

    .site-nav {
        width: 100%;
        gap: 0.25rem 0.75rem;
    }

    .site-header__actions,
    .site-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .site-actions .btn-telegram {
        margin-inline-start: auto;
    }

    .btn-telegram {
        font-size: 0.8em;
        padding: 0.45rem 0.8rem;
    }

    .post-card:hover {
        transform: none;
    }
}

@media (max-width: 400px) {
    .site-actions a:not(.btn-telegram) {
        font-size: 0.82rem;
        padding: 0.35rem 0.4rem;
    }

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

@media (prefers-reduced-motion: reduce) {
    .post-card,
    .related-card,
    .telegram-link-btn {
        transition: none;
    }

    .post-card:hover,
    .related-card:hover,
    .telegram-link-btn:hover {
        transform: none;
    }
}
