/* TheFapper UI — layout, grids, navigation. Does not change SEO markup. */

:root {
    --tf-bg: #0e0e0e;
    --tf-panel: #161616;
    --tf-panel-2: #1c1c1c;
    --tf-border: rgba(255, 255, 255, 0.08);
    --tf-red: #e11d2e;
    --tf-red-dark: #b91c1c;
    --tf-text: #f4f4f5;
    --tf-muted: #a1a1aa;
    --tf-radius: 14px;
}

.page-body.g1-row-padding-m {
    padding-top: 18px;
}

.page-body .g1-column {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    float: none;
}

.tf-section-title,
.page-body ul.g1-collection-items > h1,
.page-body ul.g1-collection-items > h2,
.page-body .g1-collection-viewport > h1,
.page-body .g1-collection-viewport > h2 {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 8px 4px 6px !important;
    padding: 0 4px 10px !important;
    font-size: clamp(1.15rem, 2.2vw, 1.55rem) !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
    color: var(--tf-text);
    border-bottom: 1px solid var(--tf-border);
}

/* ===== Toolbars ===== */
.tf-post-toolbar,
.tf-profile-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin: 12px auto 20px;
    padding: 10px 12px;
    border-radius: var(--tf-radius);
    background: var(--tf-panel);
    border: 1px solid var(--tf-border);
}

.tf-post-toolbar {
    max-width: 980px;
}

.tf-toolbar-main {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
    justify-content: center;
}

.tf-toolbar-links {
    display: flex;
    gap: 14px;
    justify-content: center;
    width: 100%;
}

.tf-link {
    color: var(--tf-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.tf-link:hover {
    color: #fff;
}

.tf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 650;
    text-decoration: none;
    border: 1px solid transparent;
    transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
    white-space: nowrap;
}

.tf-btn-primary,
.tf-btn-accent {
    background: linear-gradient(180deg, #ef4444 0%, var(--tf-red-dark) 100%);
    color: #fff;
    border-color: #7f1d1d;
    min-width: 132px;
}

.tf-btn-accent {
    background: #1f1f1f;
    border-color: rgba(225, 29, 46, 0.55);
    color: #fff;
}

.tf-btn-ghost {
    background: #1a1a1a;
    color: #f3f4f6;
    border-color: #333;
}

.tf-btn-primary:hover,
.tf-btn-accent:hover,
.tf-btn-ghost:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    color: #fff;
}

.tf-btn-disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 650;
    background: #242424;
    color: #6b7280;
    border: 1px dashed #3f3f46;
    min-width: 132px;
    opacity: 0.7;
}

.tf-count-chip {
    margin-left: auto;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(225, 29, 46, 0.12);
    color: #fecaca;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ===== Profile header ===== */
.tf-profile-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 22px;
    max-width: 1100px;
    margin: 8px auto 4px;
    padding: 18px 18px 8px;
    background: linear-gradient(180deg, #191919 0%, #121212 100%);
    border: 1px solid var(--tf-border);
    border-radius: 18px;
}

.tf-profile-header .w-56,
.tf-profile-header .h-56,
.tf-profile-header .w-56.h-56 {
    width: 148px !important;
    height: 148px !important;
    max-width: 148px;
}

.tf-profile-header img {
    object-fit: cover;
}

.tf-profile-header .w-20 {
    display: none;
}

.tf-profile-header h1 {
    font-size: clamp(1.2rem, 2.4vw, 1.7rem) !important;
    line-height: 1.3 !important;
    margin: 0 0 8px !important;
}

.tf-profile-header p {
    color: var(--tf-muted);
    max-width: 640px;
}

/* ===== Grids ===== */
.page-body .g1-collection-viewport {
    width: 100% !important;
    overflow: visible !important;
}

.page-body ul.g1-collection-items,
.page-body ul.g1-filter-items {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 16px;
    list-style: none !important;
    padding: 4px 0 28px !important;
    margin: 0 !important;
    width: 100% !important;
    float: none !important;
}

.page-body ul.g1-collection-items > ul.g1-filter-items {
    display: contents !important;
}

.page-body ul.g1-collection-items > :not(li):not(ul),
.page-body ul.g1-filter-items > :not(li) {
    grid-column: 1 / -1;
}

.page-body .g1-collection-item,
.page-body .g1-collection-item-1of3,
.page-body .g1-collection-item-1of4 {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: none !important;
}

.page-body .g1-collection-item .entry-tpl-grid,
.page-body .g1-collection-item article {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0;
    background: var(--tf-panel);
    border: 1px solid var(--tf-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.page-body .g1-collection-item article:hover {
    transform: translateY(-3px);
    border-color: rgba(225, 29, 46, 0.45);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
}

.page-body .entry-featured-media {
    margin: 0 !important;
}

.page-body .g1-frame,
.page-body .g1-frame-inner {
    display: block !important;
    width: 100% !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #111 !important;
    box-shadow: none !important;
}

.page-body .entry-featured-media img.thumb,
.page-body .g1-frame-inner img.thumb {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 4;
    object-fit: cover !important;
    display: block;
}

.page-body .entry-body {
    padding: 10px 10px 12px !important;
}

.page-body .entry-title,
.page-body .entry-title a {
    font-size: 0.82rem !important;
    line-height: 1.35 !important;
    font-weight: 600 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.page-body .entry-categories-inner a,
.page-body .entry-category {
    font-size: 0.68rem !important;
    line-height: 1.2 !important;
    padding: 3px 7px !important;
    border-radius: 999px !important;
    background: rgba(0, 0, 0, 0.55) !important;
    margin: 0 3px 3px 0 !important;
}

.page-body .entry-categories-inner a span {
    font-size: 0.86rem !important;
    line-height: 1.2 !important;
}

.page-body .entry-date,
.page-body .entry-meta {
    color: var(--tf-muted);
    font-size: 0.72rem;
}

.tf-profile-layout .entry-title {
    font-size: 0.78rem !important;
}

/* ===== Post viewer ===== */
.tf-post-title-wrap {
    max-width: 980px;
    margin: 0 auto 4px;
    padding: 0 12px;
    text-align: center;
}

.tf-post-title-wrap h1 {
    font-size: clamp(1.15rem, 2.6vw, 1.65rem);
    line-height: 1.3;
    margin: 0 0 8px;
}

.tf-post-title-wrap p {
    color: var(--tf-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.tf-post-media {
    position: relative;
    margin: 0 auto 22px;
    max-width: min(920px, 100%);
    padding: 0 8px;
}

.tf-post-media img,
.tf-post-media video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 82vh;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 12px;
    background: #050505;
    border: 1px solid var(--tf-border);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.tf-media-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(12, 12, 12, 0.72);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 1.4rem;
    text-decoration: none;
    backdrop-filter: blur(6px);
}

.tf-media-arrow:hover {
    background: var(--tf-red);
    color: #fff;
}

.tf-media-prev { left: 16px; }
.tf-media-next { right: 16px; }

.tf-post-media .element {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: auto !important;
    transform: translate(-50%, -50%);
    z-index: 7;
    text-align: center;
}

.tf-post-media .buttonn {
    white-space: normal;
    line-height: 1.35;
    padding: 12px 14px;
    font-size: 14px;
    max-width: min(280px, 86vw);
}

.tf-post-media .buttonn img {
    width: 64px !important;
    height: auto;
    margin: 8px auto;
    display: block;
}

.tf-related {
    max-width: 1280px;
    margin: 8px auto 32px;
    padding: 0 8px;
}

.tf-related-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
    padding: 0 4px;
}

.tf-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.tf-related-card {
    display: block;
    overflow: hidden;
    border-radius: 10px;
    background: #111;
    border: 1px solid var(--tf-border);
}

.tf-related-card img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.tf-related-card:hover img {
    transform: scale(1.04);
}

/* ===== Pagination ===== */
.g1-pagination {
    margin: 8px 0 28px;
}

.g1-pagination ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 0;
    list-style: none;
}

.g1-pagination .button-10,
.button-10 {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    min-width: 42px;
    padding: 8px 14px !important;
    border-radius: 999px !important;
    background: #1f1f1f !important;
    border: 1px solid #3f3f46 !important;
    color: #fff !important;
    box-shadow: none !important;
    text-decoration: none;
}

.g1-pagination-item-current .button-10,
.g1-pagination-item-current strong.button-10 {
    background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%) !important;
    border-color: #7f1d1d !important;
}

/* Header polish */
.g1-quick-nav-menu a {
    font-size: 11px;
    letter-spacing: 0.04em;
}

.g1-primary-nav-menu > li > a {
    font-weight: 700;
    letter-spacing: 0.04em;
}

@media (max-width: 768px) {
    .page-body ul.g1-collection-items,
    .page-body ul.g1-filter-items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .tf-profile-header {
        justify-content: center;
        text-align: center;
        padding: 16px 12px 8px;
    }

    .tf-profile-header .lg\:w\/8\/12,
    .tf-profile-header .flex-1 {
        align-items: center !important;
    }

    .tf-profile-toolbar .tf-btn {
        flex: 1 1 calc(50% - 8px);
    }

    .tf-count-chip {
        width: 100%;
        text-align: center;
        margin: 0;
    }

    .tf-post-toolbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        z-index: 80;
        margin: 0;
        border-radius: 16px 16px 0 0;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
    }

    .tf-toolbar-links {
        display: none;
    }

    .tf-toolbar-main {
        width: 100%;
    }

    .tf-toolbar-main .tf-btn span {
        display: none;
    }

    .tf-toolbar-main .tf-btn,
    .tf-toolbar-main .tf-btn-disabled {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
    }

    .tf-toolbar-main .tf-btn-accent span {
        display: inline;
        max-width: 92px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.single-post-view {
        padding-bottom: 86px;
    }

    .tf-media-arrow {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }

    .tf-media-prev { left: 6px; }
    .tf-media-next { right: 6px; }

    .tf-related-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .page-body ul.g1-collection-items,
    .page-body ul.g1-filter-items {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1101px) {
    .page-body ul.g1-collection-items,
    .page-body ul.g1-filter-items {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (min-width: 1400px) {
    .page-body ul.g1-collection-items,
    .page-body ul.g1-filter-items {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}
