/* common-styles.css - Общие стили для обеих страниц */

html, body {
    min-height: 100%;
    margin: 0;
    font-family: Inter, Roboto, Arial, Helvetica, sans-serif;
    position: relative;
    background: #0e1621;
    background: linear-gradient(135deg, #0e1621 0%, #17212b 50%, #0b1118 100%);
    background-attachment: fixed;
    color: #f5f5f5;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: url('https://telegram.org/img/tgme/pattern.svg') repeat center center fixed;
    opacity: 0.08;
    filter: invert(1);
    pointer-events: none;
    z-index: 0;
}

.page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: normal;
    min-height: 100vh;
    padding: 10px;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    gap: 15px;
}

.post {
    width: fit-content;
    min-width: min(240px, 100%);
    max-width: 600px;
    box-sizing: border-box;
    background: #182533;
    color: #f5f5f5;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.post-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.post-header .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 10px;
    background: #242f3d;
    flex-shrink: 0;
}

.post-header .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.post-header .avatar-fallback {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    margin-right: 10px;
    flex-shrink: 0;
}

.post-header .meta {
    display: flex;
    flex-direction: column;
}

.post-header .name {
    font-weight: 600;
    font-size: 15px;
    color: #ffffff;
}

.post-header .name a {
    color: #ffffff;
    text-decoration: none;
}

.post-header .name a:hover {
    text-decoration: underline;
}

.post-header .time {
    font-size: 12px;
    color: #708499;
}

.images-row {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;           /* важно для галереи */
}

.image-card {
    flex: 1;
    width: fit-content;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 4px;
    overflow: hidden;
    background: #121b25;
}

/* Галерея из 3+ фото — делаем их чуть меньше */
.gallery-row .image-card {
    flex-basis: 32%;
    max-width: 32%;
}

@media (max-width: 780px) {
    .gallery-row .image-card {
        flex-basis: 48%;
        max-width: 48%;
    }
}

.img-wrap {
    height: auto;
    max-height: 85vh;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0d141c;
}

/* Стили для изображений И видео в превью (чтобы видео выглядело точно так же как фото) */
.img-wrap img,
.img-wrap video {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
    display: block;
    margin: 0 auto;
}

.img-wrap:hover img,
.img-wrap:hover video {
    transform: scale(1.02);
}

.caption {
    padding: 8px 10px;
    font-size: 13px;
    text-align: center;
    line-height: 1.5;
    color: #e4ecf2;
}

.caption a {
    color: #64b5f6;
    text-decoration: none;
}

.caption a:hover {
    text-decoration: underline;
}

.reclam-body {
    padding: 8px 10px;
    color: #e4ecf2;
    line-height: 1.5;
}

.reclam-body a {
    color: #64b5f6;
    text-decoration: none;
}

.reclam-body a:hover {
    text-decoration: underline;
}

/* Telegram dark theme inline button */
.post-actions {
    padding: 4px 10px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tg-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 16px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.08);
    color: #64b5f6;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
    cursor: pointer;
    user-select: none;
}

.tg-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #90caf9;
    text-decoration: none;
}

.tg-btn:active {
    transform: scale(0.99);
    background: rgba(255, 255, 255, 0.2);
}

/* Fullscreen overlay styles */
.fullscreen-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 16, 22, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-in;
    transition: opacity 0.2s ease;
}

.fullscreen-overlay.zoomed {
    cursor: grab;
    overflow: hidden;
}

.fullscreen-overlay.zoomed.dragging {
    cursor: grabbing;
}

.fullscreen-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 95vw;
    max-height: 95vh;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-overlay.zoomed .fullscreen-container {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
}

.fullscreen-overlay img {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 3px;
    user-select: none;
    -webkit-user-drag: none;
    display: block;
}

.fullscreen-overlay video {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 3px;
    user-select: none;
    -webkit-user-drag: none;
    display: block;
    background: #111;
}

.fullscreen-overlay.zoomed img {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    cursor: grab;
}

.fullscreen-overlay.zoomed.dragging img {
    cursor: grabbing;
}

.fullscreen-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: background 0.2s ease;
}

.fullscreen-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

@media (max-width: 780px) {
    .post {
        max-width: 100%;
    }
    .img-wrap {
        height: auto;
        max-height: 80vh;
    }
    .img-wrap img,
    .img-wrap video {
        max-height: 80vh;
        max-width: 100%;
        width: auto;
        height: auto;
    }
    .page {
        gap: 10px;
    }
}
